https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8296d6c1ef7d34ee4d47b9c00ec1412534c0ee45

commit 8296d6c1ef7d34ee4d47b9c00ec1412534c0ee45
Author:     Amine Khaldi <amine.kha...@reactos.org>
AuthorDate: Wed Apr 11 12:29:04 2018 +0100
Commit:     Amine Khaldi <amine.kha...@reactos.org>
CommitDate: Wed Apr 11 12:29:04 2018 +0100

    [WIDL] Sync with Wine Staging 3.3. CORE-14434
---
 media/doc/README.WINE       |   2 +-
 sdk/tools/widl/hash.c       |   6 +
 sdk/tools/widl/header.c     |  14 +-
 sdk/tools/widl/parser.l     | 105 +++++++-------
 sdk/tools/widl/parser.tab.c |   8 +-
 sdk/tools/widl/parser.tab.h |   6 +-
 sdk/tools/widl/parser.y     |   2 +-
 sdk/tools/widl/parser.yy.c  | 105 +++++++-------
 sdk/tools/widl/parser.yy.h  | 325 ++++++++++++++++++++++++++++++++++++++++++++
 sdk/tools/widl/proxy.c      |  14 ++
 sdk/tools/widl/typegen.c    |   4 +
 sdk/tools/widl/typelib.c    |   6 +
 sdk/tools/widl/write_msft.c |   7 +
 sdk/tools/widl/write_sltg.c |   5 +
 14 files changed, 497 insertions(+), 112 deletions(-)

diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 0667b21ba9..d65efe21ad 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -16,7 +16,7 @@ wine-patc...@winehq.com and ros-...@reactos.org
 The following build tools are shared with Wine.
 
 reactos/sdk/tools/unicode               # Synced to WineStaging-3.3
-reactos/sdk/tools/widl                  # Synced to WineStaging-2.16
+reactos/sdk/tools/widl                  # Synced to WineStaging-3.3
 reactos/sdk/tools/wpp                   # Synced to WineStaging-2.9
 
 The following libraries are shared with Wine.
diff --git a/sdk/tools/widl/hash.c b/sdk/tools/widl/hash.c
index a084a7c885..673625ed1e 100644
--- a/sdk/tools/widl/hash.c
+++ b/sdk/tools/widl/hash.c
@@ -21,7 +21,13 @@
 #include <stdio.h>
 #include <stdarg.h>
 
+#ifdef __REACTOS__
 #include <nls.h>
+#else
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+#endif
 
 #include "widltypes.h"
 #include "hash.h"
diff --git a/sdk/tools/widl/header.c b/sdk/tools/widl/header.c
index 27bca0ed0d..6493253aee 100644
--- a/sdk/tools/widl/header.c
+++ b/sdk/tools/widl/header.c
@@ -960,7 +960,7 @@ static void write_method_macro(FILE *header, const type_t 
*iface, const type_t *
     if (is_override_method(iface, child, func))
       continue;
 
-    if (!is_callas(func->attrs) && !is_aggregate_return(func)) {
+    if (!is_callas(func->attrs)) {
       const var_t *arg;
 
       fprintf(header, "#define %s_%s(This", name, get_name(func));
@@ -969,6 +969,12 @@ static void write_method_macro(FILE *header, const type_t 
*iface, const type_t *
               fprintf(header, ",%s", arg->name);
       fprintf(header, ") ");
 
+      if (is_aggregate_return(func))
+      {
+        fprintf(header, 
"%s_%s_define_WIDL_C_INLINE_WRAPPERS_for_aggregate_return_support\n", name, 
get_name(func));
+        continue;
+      }
+
       fprintf(header, "(This)->lpVtbl->%s(This", get_vtbl_entry_name(iface, 
func));
       if (type_get_function_args(func->type))
           LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const 
var_t, entry )
@@ -1128,7 +1134,11 @@ static void write_inline_wrappers(FILE *header, const 
type_t *iface, const type_
     if (!is_callas(func->attrs)) {
       const var_t *arg;
 
+#ifdef __REACTOS__
       fprintf(header, "FORCEINLINE ");
+#else
+      fprintf(header, "static FORCEINLINE ");
+#endif
       write_type_decl_left(header, type_function_get_rettype(func->type));
       fprintf(header, " %s_%s(", name, get_name(func));
       write_args(header, type_get_function_args(func->type), name, 1, FALSE);
@@ -1163,6 +1173,7 @@ static void do_write_c_method_def(FILE *header, const 
type_t *iface, const char
 
   if (type_iface_get_inherit(iface))
     do_write_c_method_def(header, type_iface_get_inherit(iface), name);
+#ifdef __REACTOS__ /* r59312 / 3ab1571 */
   else if (type_iface_get_stmts(iface) == NULL)
   {
     fprintf(header, "#ifndef __cplusplus\n");
@@ -1172,6 +1183,7 @@ static void do_write_c_method_def(FILE *header, const 
type_t *iface, const char
     fprintf(header, "\n");
     return;
   }
+#endif
 
   STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
   {
diff --git a/sdk/tools/widl/parser.l b/sdk/tools/widl/parser.l
index 6520ce72e6..a57ac648b8 100644
--- a/sdk/tools/widl/parser.l
+++ b/sdk/tools/widl/parser.l
@@ -78,7 +78,7 @@ static int attr_token(const char *kw);
 
 static warning_list_t *disabled_warnings = NULL;
 
-#define MAX_IMPORT_DEPTH 10
+#define MAX_IMPORT_DEPTH 20
 struct {
   YY_BUFFER_STATE state;
   char *input_name;
@@ -495,60 +495,63 @@ void pop_import(void)
 }
 
 struct imports {
-       char *name;
-       struct imports *next;
+    char *name;
+    struct imports *next;
 } *first_import;
 
 int do_import(char *fname)
 {
-       FILE *f;
-       char *path, *name;
-       struct imports *import;
-       int ptr = import_stack_ptr;
-       int ret, fd;
-
-       import = first_import;
-       while (import && strcmp(import->name, fname))
-               import = import->next;
-       if (import) return 0; /* already imported */
-
-       import = xmalloc(sizeof(struct imports));
-       import->name = xstrdup(fname);
-       import->next = first_import;
-       first_import = import;
-
-        /* don't search for a file name with a path in the include directories,
-         * for compatibility with MIDL */
-        if (strchr( fname, '/' ) || strchr( fname, '\\' ))
-            path = xstrdup( fname );
-        else if (!(path = wpp_find_include( fname, input_name )))
-            error_loc("Unable to open include file %s\n", fname);
-
-       import_stack[ptr].temp_name = temp_name;
-       import_stack[ptr].input_name = input_name;
-       import_stack[ptr].line_number = line_number;
-       import_stack_ptr++;
-        input_name = path;
-        line_number = 1;
-
-        name = xstrdup( "widl.XXXXXX" );
-        if((fd = mkstemps( name, 0 )) == -1)
-            error("Could not generate a temp name from %s\n", name);
-
-        temp_name = name;
-        if (!(f = fdopen(fd, "wt")))
-            error("Could not open fd %s for writing\n", name);
-
-        ret = wpp_parse( path, f );
-        fclose( f );
-        if (ret) exit(1);
-
-       if((f = fopen(temp_name, "r")) == NULL)
-               error_loc("Unable to open %s\n", temp_name);
-
-       import_stack[ptr].state = YY_CURRENT_BUFFER;
-       yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
-       return 1;
+    FILE *f;
+    char *path, *name;
+    struct imports *import;
+    int ptr = import_stack_ptr;
+    int ret, fd;
+
+    import = first_import;
+    while (import && strcmp(import->name, fname))
+        import = import->next;
+    if (import) return 0; /* already imported */
+
+    import = xmalloc(sizeof(struct imports));
+    import->name = xstrdup(fname);
+    import->next = first_import;
+    first_import = import;
+
+    /* don't search for a file name with a path in the include directories,
+     * for compatibility with MIDL */
+    if (strchr( fname, '/' ) || strchr( fname, '\\' ))
+        path = xstrdup( fname );
+    else if (!(path = wpp_find_include( fname, input_name )))
+        error_loc("Unable to open include file %s\n", fname);
+
+    if (import_stack_ptr == MAX_IMPORT_DEPTH)
+        error_loc("Exceeded max import depth\n");
+
+    import_stack[ptr].temp_name = temp_name;
+    import_stack[ptr].input_name = input_name;
+    import_stack[ptr].line_number = line_number;
+    import_stack_ptr++;
+    input_name = path;
+    line_number = 1;
+
+    name = xstrdup( "widl.XXXXXX" );
+    if((fd = mkstemps( name, 0 )) == -1)
+        error("Could not generate a temp name from %s\n", name);
+
+    temp_name = name;
+    if (!(f = fdopen(fd, "wt")))
+        error("Could not open fd %s for writing\n", name);
+
+    ret = wpp_parse( path, f );
+    fclose( f );
+    if (ret) exit(1);
+
+    if((f = fopen(temp_name, "r")) == NULL)
+        error_loc("Unable to open %s\n", temp_name);
+
+    import_stack[ptr].state = YY_CURRENT_BUFFER;
+    yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
+    return 1;
 }
 
 void abort_import(void)
diff --git a/sdk/tools/widl/parser.tab.c b/sdk/tools/widl/parser.tab.c
index 016c4ef0ea..3d52c09450 100644
--- a/sdk/tools/widl/parser.tab.c
+++ b/sdk/tools/widl/parser.tab.c
@@ -228,8 +228,8 @@ static struct namespace *current_namespace = 
&global_namespace;
 
 /* In a future release of Bison, this section will be replaced
    by #include "parser.tab.h".  */
-#ifndef 
YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
-# define 
YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
+#ifndef 
YY_PARSER_E_REACTOSSYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
+# define 
YY_PARSER_E_REACTOSSYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -475,7 +475,7 @@ extern YYSTYPE parser_lval;
 
 int parser_parse (void);
 
-#endif /* 
!YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED  
*/
+#endif /* 
!YY_PARSER_E_REACTOSSYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED  */
 
 /* Copy the second part of user declarations.  */
 
@@ -5975,7 +5975,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, 
declarator_list_t *decls, at
         type->attrs = attrs;
   }
 
-#ifdef __REACTOS__
+#ifdef __REACTOS__ /* r53187 / 5bf224e */
   /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does 
not already have it.  */
   if (type_get_type_detect_alias(type) == TYPE_UNION &&
       is_attr(attrs, ATTR_SWITCHTYPE) &&
diff --git a/sdk/tools/widl/parser.tab.h b/sdk/tools/widl/parser.tab.h
index fc50cfad9d..86600640f7 100644
--- a/sdk/tools/widl/parser.tab.h
+++ b/sdk/tools/widl/parser.tab.h
@@ -30,8 +30,8 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
-#ifndef 
YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
-# define 
YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
+#ifndef 
YY_PARSER_E_REACTOSSYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
+# define 
YY_PARSER_E_REACTOSSYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -277,4 +277,4 @@ extern YYSTYPE parser_lval;
 
 int parser_parse (void);
 
-#endif /* 
!YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED  
*/
+#endif /* 
!YY_PARSER_E_REACTOSSYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED  */
diff --git a/sdk/tools/widl/parser.y b/sdk/tools/widl/parser.y
index 1e23046f04..c895a876fc 100644
--- a/sdk/tools/widl/parser.y
+++ b/sdk/tools/widl/parser.y
@@ -1936,7 +1936,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, 
declarator_list_t *decls, at
         type->attrs = attrs;
   }
 
-#ifdef __REACTOS__
+#ifdef __REACTOS__ /* r53187 / 5bf224e */
   /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does 
not already have it.  */
   if (type_get_type_detect_alias(type) == TYPE_UNION &&
       is_attr(attrs, ATTR_SWITCHTYPE) &&
diff --git a/sdk/tools/widl/parser.yy.c b/sdk/tools/widl/parser.yy.c
index 5e7cb85ccc..1502508b87 100644
--- a/sdk/tools/widl/parser.yy.c
+++ b/sdk/tools/widl/parser.yy.c
@@ -766,7 +766,7 @@ static int attr_token(const char *kw);
 
 static warning_list_t *disabled_warnings = NULL;
 
-#define MAX_IMPORT_DEPTH 10
+#define MAX_IMPORT_DEPTH 20
 struct {
   YY_BUFFER_STATE state;
   char *input_name;
@@ -2635,60 +2635,63 @@ void pop_import(void)
 }
 
 struct imports {
-       char *name;
-       struct imports *next;
+    char *name;
+    struct imports *next;
 } *first_import;
 
 int do_import(char *fname)
 {
-       FILE *f;
-       char *path, *name;
-       struct imports *import;
-       int ptr = import_stack_ptr;
-       int ret, fd;
-
-       import = first_import;
-       while (import && strcmp(import->name, fname))
-               import = import->next;
-       if (import) return 0; /* already imported */
-
-       import = xmalloc(sizeof(struct imports));
-       import->name = xstrdup(fname);
-       import->next = first_import;
-       first_import = import;
-
-        /* don't search for a file name with a path in the include directories,
-         * for compatibility with MIDL */
-        if (strchr( fname, '/' ) || strchr( fname, '\\' ))
-            path = xstrdup( fname );
-        else if (!(path = wpp_find_include( fname, input_name )))
-            error_loc("Unable to open include file %s\n", fname);
-
-       import_stack[ptr].temp_name = temp_name;
-       import_stack[ptr].input_name = input_name;
-       import_stack[ptr].line_number = line_number;
-       import_stack_ptr++;
-        input_name = path;
-        line_number = 1;
-
-        name = xstrdup( "widl.XXXXXX" );
-        if((fd = mkstemps( name, 0 )) == -1)
-            error("Could not generate a temp name from %s\n", name);
-
-        temp_name = name;
-        if (!(f = fdopen(fd, "wt")))
-            error("Could not open fd %s for writing\n", name);
-
-        ret = wpp_parse( path, f );
-        fclose( f );
-        if (ret) exit(1);
-
-       if((f = fopen(temp_name, "r")) == NULL)
-               error_loc("Unable to open %s\n", temp_name);
-
-       import_stack[ptr].state = YY_CURRENT_BUFFER;
-       parser__switch_to_buffer(parser__create_buffer(f,YY_BUF_SIZE));
-       return 1;
+    FILE *f;
+    char *path, *name;
+    struct imports *import;
+    int ptr = import_stack_ptr;
+    int ret, fd;
+
+    import = first_import;
+    while (import && strcmp(import->name, fname))
+        import = import->next;
+    if (import) return 0; /* already imported */
+
+    import = xmalloc(sizeof(struct imports));
+    import->name = xstrdup(fname);
+    import->next = first_import;
+    first_import = import;
+
+    /* don't search for a file name with a path in the include directories,
+     * for compatibility with MIDL */
+    if (strchr( fname, '/' ) || strchr( fname, '\\' ))
+        path = xstrdup( fname );
+    else if (!(path = wpp_find_include( fname, input_name )))
+        error_loc("Unable to open include file %s\n", fname);
+
+    if (import_stack_ptr == MAX_IMPORT_DEPTH)
+        error_loc("Exceeded max import depth\n");
+
+    import_stack[ptr].temp_name = temp_name;
+    import_stack[ptr].input_name = input_name;
+    import_stack[ptr].line_number = line_number;
+    import_stack_ptr++;
+    input_name = path;
+    line_number = 1;
+
+    name = xstrdup( "widl.XXXXXX" );
+    if((fd = mkstemps( name, 0 )) == -1)
+        error("Could not generate a temp name from %s\n", name);
+
+    temp_name = name;
+    if (!(f = fdopen(fd, "wt")))
+        error("Could not open fd %s for writing\n", name);
+
+    ret = wpp_parse( path, f );
+    fclose( f );
+    if (ret) exit(1);
+
+    if((f = fopen(temp_name, "r")) == NULL)
+        error_loc("Unable to open %s\n", temp_name);
+
+    import_stack[ptr].state = YY_CURRENT_BUFFER;
+    parser__switch_to_buffer(parser__create_buffer(f,YY_BUF_SIZE));
+    return 1;
 }
 
 void abort_import(void)
diff --git a/sdk/tools/widl/parser.yy.h b/sdk/tools/widl/parser.yy.h
new file mode 100644
index 0000000000..bddc1efd7b
--- /dev/null
+++ b/sdk/tools/widl/parser.yy.h
@@ -0,0 +1,325 @@
+#ifndef parser_HEADER_H
+#define parser_HEADER_H 1
+#define parser_IN_HEADER 1
+
+#line 6 "parser.yy.h"
+
+#line 8 "parser.yy.h"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 37
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else  /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t parser_leng;
+
+extern FILE *parser_in, *parser_out;
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+       {
+       FILE *yy_input_file;
+
+       char *yy_ch_buf;                /* input buffer */
+       char *yy_buf_pos;               /* current position in input buffer */
+
+       /* Size of input buffer in bytes, not including room for EOB
+        * characters.
+        */
+       yy_size_t yy_buf_size;
+
+       /* Number of characters read into yy_ch_buf, not including EOB
+        * characters.
+        */
+       yy_size_t yy_n_chars;
+
+       /* Whether we "own" the buffer - i.e., we know we created it,
+        * and can realloc() it to grow it, and should free() it to
+        * delete it.
+        */
+       int yy_is_our_buffer;
+
+       /* Whether this is an "interactive" input source; if so, and
+        * if we're using stdio for input, then we want to use getc()
+        * instead of fread(), to make sure we stop fetching input after
+        * each newline.
+        */
+       int yy_is_interactive;
+
+       /* Whether we're considered to be at the beginning of a line.
+        * If so, '^' rules will be active on the next match, otherwise
+        * not.
+        */
+       int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+       /* Whether to try to fill the input buffer when we reach the
+        * end of it.
+        */
+       int yy_fill_buffer;
+
+       int yy_buffer_status;
+
+       };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+void parser_restart (FILE *input_file  );
+void parser__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
+YY_BUFFER_STATE parser__create_buffer (FILE *file,int size  );
+void parser__delete_buffer (YY_BUFFER_STATE b  );
+void parser__flush_buffer (YY_BUFFER_STATE b  );
+void parser_push_buffer_state (YY_BUFFER_STATE new_buffer  );
+void parser_pop_buffer_state (void );
+
+YY_BUFFER_STATE parser__scan_buffer (char *base,yy_size_t size  );
+YY_BUFFER_STATE parser__scan_string (yyconst char *yy_str  );
+YY_BUFFER_STATE parser__scan_bytes (yyconst char *bytes,yy_size_t len  );
+
+void *parser_alloc (yy_size_t  );
+void *parser_realloc (void *,yy_size_t  );
+void parser_free (void *  );
+
+/* Begin user sect3 */
+
+extern int parser_lineno;
+
+extern char *parser_text;
+#define yytext_ptr parser_text
+
+#ifdef YY_HEADER_EXPORT_START_CONDITIONS
+#define INITIAL 0
+#define QUOTE 1
+#define WSTRQUOTE 2
+#define ATTR 3
+#define PP_LINE 4
+#define PP_PRAGMA 5
+#define SQUOTE 6
+
+#endif
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+    
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int parser_lex_destroy (void );
+
+int parser_get_debug (void );
+
+void parser_set_debug (int debug_flag  );
+
+YY_EXTRA_TYPE parser_get_extra (void );
+
+void parser_set_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *parser_get_in (void );
+
+void parser_set_in  (FILE * in_str  );
+
+FILE *parser_get_out (void );
+
+void parser_set_out  (FILE * out_str  );
+
+yy_size_t parser_get_leng (void );
+
+char *parser_get_text (void );
+
+int parser_get_lineno (void );
+
+void parser_set_lineno (int line_number  );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int parser_wrap (void );
+#else
+extern int parser_wrap (void );
+#endif
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int parser_lex (void);
+
+#define YY_DECL int parser_lex (void)
+#endif /* !YY_DECL */
+
+/* yy_get_previous_state - get the state just before the EOB char was reached 
*/
+
+#undef YY_NEW_FILE
+#undef YY_FLUSH_BUFFER
+#undef yy_set_bol
+#undef yy_new_buffer
+#undef yy_set_interactive
+#undef YY_DO_BEFORE_ACTION
+
+#ifdef YY_DECL_IS_OURS
+#undef YY_DECL_IS_OURS
+#undef YY_DECL
+#endif
+
+#line 231 "parser.l"
+
+
+#line 324 "parser.yy.h"
+#undef parser_IN_HEADER
+#endif /* parser_HEADER_H */
diff --git a/sdk/tools/widl/proxy.c b/sdk/tools/widl/proxy.c
index 794fc5dc3a..376326333e 100644
--- a/sdk/tools/widl/proxy.c
+++ b/sdk/tools/widl/proxy.c
@@ -482,7 +482,11 @@ static const statement_t * get_callas_source(const type_t 
* iface, const var_t *
   return NULL;
 }
 
+#ifdef __REACTOS__ /* r57019 / c3be8a3 */
 static int write_proxy_procformatstring_offsets( const type_t *iface, int skip 
)
+#else
+static void write_proxy_procformatstring_offsets( const type_t *iface, int 
skip )
+#endif
 {
     const statement_t *stmt;
     int i = 0;
@@ -512,7 +516,9 @@ static int write_proxy_procformatstring_offsets( const 
type_t *iface, int skip )
             print_proxy( "%u,  /* %s::%s */\n", func->procstring_offset, 
iface->name, get_name(func));
         i++;
     }
+#ifdef __REACTOS__ /* r57019 / c3be8a3 */
     return i;
+#endif
 }
 
 static int write_proxy_methods(type_t *iface, int skip)
@@ -645,10 +651,14 @@ static void write_proxy(type_t *iface, unsigned int 
*proc_offset)
   print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", 
iface->name );
   print_proxy( "{\n" );
   indent++;
+#ifdef __REACTOS__ /* r57019 / c3be8a3 */
   if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
   {
       print_proxy( "0\n" );
   }
+#else
+  write_proxy_procformatstring_offsets( iface, 0 );
+#endif
   indent--;
   print_proxy( "};\n\n" );
 
@@ -722,10 +732,14 @@ static void write_proxy(type_t *iface, unsigned int 
*proc_offset)
       print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", 
iface->name);
       print_proxy( "{\n");
       indent++;
+#ifdef __REACTOS__ /* r57019 / c3be8a3 */
       if (write_stub_methods(iface, FALSE) == 0)
       {
           fprintf(proxy, "0");
       }
+#else
+      write_stub_methods(iface, FALSE);
+#endif
       fprintf(proxy, "\n");
       indent--;
       fprintf(proxy, "};\n\n");
diff --git a/sdk/tools/widl/typegen.c b/sdk/tools/widl/typegen.c
index ca3f82f955..c2e3fd6f50 100644
--- a/sdk/tools/widl/typegen.c
+++ b/sdk/tools/widl/typegen.c
@@ -4747,7 +4747,11 @@ void write_func_param_struct( FILE *file, const type_t 
*iface, const type_t *fun
         if (align >= pointer_size)
             fprintf( file, "%s;\n", arg->name );
         else
+#ifdef __REACTOS__
             fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name 
);
+#else
+            fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size 
);
+#endif
     }
     if (add_retval && !is_void( retval->type ))
     {
diff --git a/sdk/tools/widl/typelib.c b/sdk/tools/widl/typelib.c
index ba71de71ab..7c590bca49 100644
--- a/sdk/tools/widl/typelib.c
+++ b/sdk/tools/widl/typelib.c
@@ -32,7 +32,13 @@
 #include <string.h>
 #include <ctype.h>
 
+#ifdef __REACTOS__
 #include <typedefs.h>
+#else
+#include "windef.h"
+#include "winbase.h"
+#endif
+
 #include "widl.h"
 #include "utils.h"
 #include "parser.h"
diff --git a/sdk/tools/widl/write_msft.c b/sdk/tools/widl/write_msft.c
index 4ed09ee4b0..efaa633f2f 100644
--- a/sdk/tools/widl/write_msft.c
+++ b/sdk/tools/widl/write_msft.c
@@ -39,8 +39,15 @@
 
 #define NONAMELESSUNION
 
+#ifdef __REACTOS__
 #include <typedefs.h>
 #include <nls.h>
+#else
+#include "winerror.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+#endif
 
 #include "widl.h"
 #include "typelib.h"
diff --git a/sdk/tools/widl/write_sltg.c b/sdk/tools/widl/write_sltg.c
index 4efc7f00de..8f7b27afb4 100644
--- a/sdk/tools/widl/write_sltg.c
+++ b/sdk/tools/widl/write_sltg.c
@@ -30,8 +30,13 @@
 
 #define NONAMELESSUNION
 
+#ifdef __REACTOS__
 #include <typedefs.h>
 #include <nls.h>
+#else
+#include "windef.h"
+#include "winbase.h"
+#endif
 
 #include "widl.h"
 #include "typelib.h"

Reply via email to