From c3be8a39d49d730b5a7679e4e42381cdc5825337 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 1 Aug 2012 23:25:06 +0000 Subject: [PATCH] [WIDL] * Set the attribute before the variable in write_func_param_struct(). Should be sent upstream. * Initialize in an MSVC compatible way. Should be sent upstream. [REACTOS/IDLS] * Use widl instead of midl in MSVC builds. svn path=/trunk/; revision=57019 --- reactos/CMakeLists.txt | 9 +- reactos/dll/nls/idndl/CMakeLists.txt | 2 +- reactos/dll/win32/itss/CMakeLists.txt | 7 +- reactos/dll/win32/jscript/CMakeLists.txt | 19 +- reactos/dll/win32/mscoree/CMakeLists.txt | 6 - reactos/dll/win32/msxml3/CMakeLists.txt | 39 +- reactos/dll/win32/msxml3/msvc_uuid.c | 7 - reactos/dll/win32/ole32/compobj.c | 4 - reactos/dll/win32/sxs/CMakeLists.txt | 8 - reactos/dll/win32/sxs/msvchelper.h | 2 - reactos/include/psdk/hlguids.h | 4 - reactos/include/reactos/wine/port.h | 4 +- reactos/tools/CMakeLists.txt | 5 +- reactos/tools/widl/CMakeLists.txt | 5 + reactos/tools/widl/getopt.c | 436 +++++++++++++++++++++++ reactos/tools/widl/proxy.c | 19 +- reactos/tools/widl/typegen.c | 2 +- reactos/tools/wpp/CMakeLists.txt | 7 + 18 files changed, 478 insertions(+), 107 deletions(-) delete mode 100644 reactos/dll/win32/msxml3/msvc_uuid.c delete mode 100644 reactos/dll/win32/sxs/msvchelper.h create mode 100644 reactos/tools/widl/getopt.c diff --git a/reactos/CMakeLists.txt b/reactos/CMakeLists.txt index 385f94a3637..924c27181a2 100644 --- a/reactos/CMakeLists.txt +++ b/reactos/CMakeLists.txt @@ -66,7 +66,7 @@ if(NOT CMAKE_CROSSCOMPILING) if(NOT MSVC) export(TARGETS widl gendib cabman cdmake mkhive obj2bin spec2def geninc rsym mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) else() - export(TARGETS gendib cabman cdmake mkhive obj2bin spec2def geninc mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) + export(TARGETS widl gendib cabman cdmake mkhive obj2bin spec2def geninc mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) endif() else() @@ -169,11 +169,8 @@ else() include(cmake/CMakeMacros.cmake) # IDL macros for widl/midl - if (MSVC) - include(cmake/midl-support.cmake) - else() - include(cmake/widl-support.cmake) - endif() + # We're using widl now for both MSVC and GCC builds + include(cmake/widl-support.cmake) if(MSVC AND USE_WDK_HEADERS) include_directories( diff --git a/reactos/dll/nls/idndl/CMakeLists.txt b/reactos/dll/nls/idndl/CMakeLists.txt index 3eeae14fd44..322671e1780 100644 --- a/reactos/dll/nls/idndl/CMakeLists.txt +++ b/reactos/dll/nls/idndl/CMakeLists.txt @@ -12,7 +12,7 @@ set_entrypoint(idndl 0) if(NOT MSVC) add_target_compile_flags(idndl "-fno-exceptions -fno-rtti") -endif(NOT MSVC) +endif() add_importlibs(idndl kernel32) diff --git a/reactos/dll/win32/itss/CMakeLists.txt b/reactos/dll/win32/itss/CMakeLists.txt index 32598b58ef8..ad719e6e7f6 100644 --- a/reactos/dll/win32/itss/CMakeLists.txt +++ b/reactos/dll/win32/itss/CMakeLists.txt @@ -2,8 +2,6 @@ add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) -set_rc_compiler() - spec2def(itss.dll itss.spec) list(APPEND SOURCE @@ -23,9 +21,8 @@ add_library(itss SHARED set_module_type(itss win32dll) target_link_libraries(itss uuid wine) -if(MSVC) - target_link_libraries(itss itss_guid) -else() + +if(NOT MSVC) # FIXME: http://www.cmake.org/Bug/view.php?id=12998 #allow_warnings(itss) set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error") diff --git a/reactos/dll/win32/jscript/CMakeLists.txt b/reactos/dll/win32/jscript/CMakeLists.txt index e815080769d..20c11eb1660 100644 --- a/reactos/dll/win32/jscript/CMakeLists.txt +++ b/reactos/dll/win32/jscript/CMakeLists.txt @@ -10,8 +10,6 @@ add_definitions( include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) -set_rc_compiler() - spec2def(jscript.dll jscript.spec) list(APPEND SOURCE @@ -38,26 +36,11 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/jscript.def) add_library(jscript SHARED ${SOURCE}) - set_module_type(jscript win32dll) - target_link_libraries(jscript wine) -if(MSVC) - target_link_libraries(jscript uuid) -endif() - -add_importlibs(jscript - msvcrt - user32 - ole32 - oleaut32 - advapi32 - kernel32 - ntdll) - +add_importlibs(jscript user32 ole32 oleaut32 advapi32 msvcrt kernel32 ntdll) add_pch(jscript jscript.h) # jsglobal.tlb needs stdole2.tlb add_dependencies(jscript stdole2) add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all) - set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/jsglobal.tlb) diff --git a/reactos/dll/win32/mscoree/CMakeLists.txt b/reactos/dll/win32/mscoree/CMakeLists.txt index 1c386979ca3..eaae3c552aa 100644 --- a/reactos/dll/win32/mscoree/CMakeLists.txt +++ b/reactos/dll/win32/mscoree/CMakeLists.txt @@ -20,13 +20,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/mscoree.def) add_library(mscoree SHARED ${SOURCE}) - set_module_type(mscoree win32dll) target_link_libraries(mscoree wine uuid) - -if(MSVC) - target_link_libraries(mscoree xml_uuids) -endif() - add_importlibs(mscoree dbghelp advapi32 shell32 ole32 shlwapi msvcrt kernel32 ntdll) add_cd_file(TARGET mscoree DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/msxml3/CMakeLists.txt b/reactos/dll/win32/msxml3/CMakeLists.txt index 0144b4c5768..1180997603b 100644 --- a/reactos/dll/win32/msxml3/CMakeLists.txt +++ b/reactos/dll/win32/msxml3/CMakeLists.txt @@ -9,12 +9,10 @@ add_definitions( if(MSVC) add_compile_flags("/FIwine/typeof.h /FImsvc.h") -endif(MSVC) +endif() include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) -set_rc_compiler() - spec2def(msxml3.dll msxml3.spec) add_typelib(msxml3_v1.idl) @@ -50,43 +48,12 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msxml3.def) -if(MSVC) - list(APPEND SOURCE msvc_uuid.c) -endif() - add_library(msxml3 SHARED ${SOURCE}) - set_module_type(msxml3 win32dll) - set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msxml3_v1.tlb) +target_link_libraries(msxml3 libxml2 uuid wine wineldr) -target_link_libraries(msxml3 - libxml2 - uuid - wine - wineldr) - -if(MSVC) - target_link_libraries(msxml3 xml_uuids) -endif() - -add_importlibs(msxml3 - msvcrt - urlmon - wininet - ws2_32 - comctl32 - shell32 - shlwapi - cabinet - oleaut32 - ole32 - version - user32 - gdi32 - advapi32 - kernel32 - ntdll) +add_importlibs(msxml3 urlmon wininet ws2_32 comctl32 shell32 shlwapi cabinet oleaut32 ole32 version user32 gdi32 advapi32 msvcrt kernel32 ntdll) # msxml3_v1.tlb needs stdole2.tlb add_dependencies(msxml3 stdole2) diff --git a/reactos/dll/win32/msxml3/msvc_uuid.c b/reactos/dll/win32/msxml3/msvc_uuid.c deleted file mode 100644 index b2c502719b7..00000000000 --- a/reactos/dll/win32/msxml3/msvc_uuid.c +++ /dev/null @@ -1,7 +0,0 @@ - -#define INITGUID -#include - -// This is actually CLSID_DOMDocument, but on gcc builds its defined to be like this -DEFINE_GUID(CLSID_DOMDocument2, 0x2933bf90, 0x7b36, 0x11d2, 0xb2,0x0e, 0x00,0xc0,0x4f,0x98,0x3e,0x60); - diff --git a/reactos/dll/win32/ole32/compobj.c b/reactos/dll/win32/ole32/compobj.c index 12356092990..72ba32ac6be 100644 --- a/reactos/dll/win32/ole32/compobj.c +++ b/reactos/dll/win32/ole32/compobj.c @@ -70,10 +70,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); #define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0])) -#ifdef _MSC_VER -DEFINE_GUID(CLSID_PSFactoryBuffer, 0x00000320, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46); -#endif - /**************************************************************************** * This section defines variables internal to the COM module. */ diff --git a/reactos/dll/win32/sxs/CMakeLists.txt b/reactos/dll/win32/sxs/CMakeLists.txt index d2db519acf6..7aedf2fcfdc 100644 --- a/reactos/dll/win32/sxs/CMakeLists.txt +++ b/reactos/dll/win32/sxs/CMakeLists.txt @@ -13,15 +13,7 @@ list(APPEND SOURCE add_library(sxs SHARED ${SOURCE}) set_module_type(sxs win32dll ENTRYPOINT 0 ) - target_link_libraries(sxs wine) - -if(MSVC) - set_source_files_properties(cache.c PROPERTIES COMPILE_FLAGS /FImsvchelper.h) - target_link_libraries(sxs uuid) -endif() - add_importlibs(sxs oleaut32 ole32 kernel32 ntdll) add_dependencies(sxs psdk) - add_cd_file(TARGET sxs DESTINATION reactos/system32 FOR all) diff --git a/reactos/dll/win32/sxs/msvchelper.h b/reactos/dll/win32/sxs/msvchelper.h deleted file mode 100644 index 1e4f5ceb4cf..00000000000 --- a/reactos/dll/win32/sxs/msvchelper.h +++ /dev/null @@ -1,2 +0,0 @@ -#include -const CLSID CLSID_DOMDocument2 = {0xf6d90f11, 0x9c73, 0x11d3, {0xb3, 0x2e, 0x00,0xc0, 0x4f, 0x99, 0x0b, 0xb4}}; diff --git a/reactos/include/psdk/hlguids.h b/reactos/include/psdk/hlguids.h index 9083a76a951..7a45e668d86 100644 --- a/reactos/include/psdk/hlguids.h +++ b/reactos/include/psdk/hlguids.h @@ -27,9 +27,5 @@ DEFINE_GUID(CLSID_StdHlinkBrowseContext, 0x79eac9d1, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b); DEFINE_GUID(CLSID_IID_IExtensionServices, 0x79eac9cb, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b); -#ifndef __GNUC__ -DEFINE_GUID(IID_IBindStatusCallback, - 0x79eac9c1, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b); -#endif #endif diff --git a/reactos/include/reactos/wine/port.h b/reactos/include/reactos/wine/port.h index 70bf3c38140..f3714531675 100644 --- a/reactos/include/reactos/wine/port.h +++ b/reactos/include/reactos/wine/port.h @@ -153,7 +153,9 @@ struct statfs; /* Constructor functions */ -#ifdef __GNUC__ +#ifdef _MSC_VER +# define DECL_GLOBAL_CONSTRUCTOR(func) /* nothing */ +#elif defined(__GNUC__) # define DECL_GLOBAL_CONSTRUCTOR(func) \ static void func(void) __attribute__((constructor)); \ static void func(void) diff --git a/reactos/tools/CMakeLists.txt b/reactos/tools/CMakeLists.txt index b5d8e8f7344..9513d4052f9 100644 --- a/reactos/tools/CMakeLists.txt +++ b/reactos/tools/CMakeLists.txt @@ -14,9 +14,8 @@ add_subdirectory(obj2bin) add_subdirectory(spec2def) add_subdirectory(unicode) add_subdirectory(mkshelllink) - -if(NOT MSVC) -add_subdirectory(rsym) add_subdirectory(widl) add_subdirectory(wpp) +if(NOT MSVC) + add_subdirectory(rsym) endif() diff --git a/reactos/tools/widl/CMakeLists.txt b/reactos/tools/widl/CMakeLists.txt index d11f1fa9948..5a4434da82d 100644 --- a/reactos/tools/widl/CMakeLists.txt +++ b/reactos/tools/widl/CMakeLists.txt @@ -1,4 +1,9 @@ +if(MSVC) + add_definitions(-Dsnprintf=_snprintf) + list(APPEND SOURCE getopt.c) +endif() + list(APPEND SOURCE client.c expr.c diff --git a/reactos/tools/widl/getopt.c b/reactos/tools/widl/getopt.c new file mode 100644 index 00000000000..c41bb0f8b63 --- /dev/null +++ b/reactos/tools/widl/getopt.c @@ -0,0 +1,436 @@ +/* + * Copyright (c) 1987, 1993, 1994, 1996 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include + +extern int opterr; /* if error message should be printed */ +extern int optind; /* index into parent argv vector */ +extern int optopt; /* character checked for validity */ +extern int optreset; /* reset getopt */ +extern char *optarg; /* argument associated with option */ + +int getopt (int, char * const *, const char *); + +struct option { + const char *name; + int has_arg; + int *flag; + int val; +}; + +int getopt_long (int, char *const *, const char *, const struct option *, int *); + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#define REPLACE_GETOPT + +#define _DIAGASSERT(x) do {} while (0) + +#ifdef REPLACE_GETOPT +int opterr = 1; +int optind = 1; +int optopt = '?'; +int optreset; +char *optarg; +#endif + +#define __progname __argv[0] + +#define IGNORE_FIRST (*options == '-' || *options == '+') +#define PRINT_ERROR ((opterr) && ((*options != ':') || (IGNORE_FIRST && options[1] != ':'))) + +#ifndef IS_POSIXLY_CORRECT +#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL) +#endif + +#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST) + +#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-') + +#define BADCH (int)'?' +#define BADARG ((IGNORE_FIRST && options[1] == ':') || (*options == ':') ? (int)':' : (int)'?') +#define INORDER (int)1 + +static char EMSG[1]; + +static int getopt_internal (int,char * const *,const char *); +static int gcd (int,int); +static void permute_args (int,int,int,char * const *); + +static char *place = EMSG; + +static int nonopt_start = -1; +static int nonopt_end = -1; + +static const char recargchar[] = "option requires an argument -- %c"; +static const char recargstring[] = "option requires an argument -- %s"; +static const char ambig[] = "ambiguous option -- %.*s"; +static const char noarg[] = "option doesn't take an argument -- %.*s"; +static const char illoptchar[] = "unknown option -- %c"; +static const char illoptstring[] = "unknown option -- %s"; + +static void +_vwarnx(const char *fmt,va_list ap) +{ + (void)fprintf(stderr,"%s: ",__progname); + if (fmt != NULL) + (void)vfprintf(stderr,fmt,ap); + (void)fprintf(stderr,"\n"); +} + +static void +warnx(const char *fmt,...) +{ + va_list ap; + va_start(ap,fmt); + _vwarnx(fmt,ap); + va_end(ap); +} + +static int +gcd(a,b) + int a; + int b; +{ + int c; + + c = a % b; + while (c != 0) { + a = b; + b = c; + c = a % b; + } + + return b; +} + +static void +permute_args(panonopt_start,panonopt_end,opt_end,nargv) + int panonopt_start; + int panonopt_end; + int opt_end; + char * const *nargv; +{ + int cstart,cyclelen,i,j,ncycle,nnonopts,nopts,pos; + char *swap; + + _DIAGASSERT(nargv != NULL); + + nnonopts = panonopt_end - panonopt_start; + nopts = opt_end - panonopt_end; + ncycle = gcd(nnonopts,nopts); + cyclelen = (opt_end - panonopt_start) / ncycle; + + for (i = 0; i < ncycle; i++) { + cstart = panonopt_end+i; + pos = cstart; + for (j = 0; j < cyclelen; j++) { + if (pos >= panonopt_end) + pos -= nnonopts; + else + pos += nopts; + swap = nargv[pos]; + + ((char **) nargv)[pos] = nargv[cstart]; + + ((char **)nargv)[cstart] = swap; + } + } +} + +static int +getopt_internal(nargc,nargv,options) + int nargc; + char * const *nargv; + const char *options; +{ + char *oli; + int optchar; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + + optarg = NULL; + + if (optind == 0) + optind = 1; + + if (optreset) + nonopt_start = nonopt_end = -1; +start: + if (optreset || !*place) { + optreset = 0; + if (optind >= nargc) { + place = EMSG; + if (nonopt_end != -1) { + + permute_args(nonopt_start,nonopt_end,optind,nargv); + optind -= nonopt_end - nonopt_start; + } + else if (nonopt_start != -1) { + + optind = nonopt_start; + } + nonopt_start = nonopt_end = -1; + return -1; + } + if ((*(place = nargv[optind]) != '-') + || (place[1] == '\0')) { + place = EMSG; + if (IN_ORDER) { + + optarg = nargv[optind++]; + return INORDER; + } + if (!PERMUTE) { + + return -1; + } + + if (nonopt_start == -1) + nonopt_start = optind; + else if (nonopt_end != -1) { + permute_args(nonopt_start,nonopt_end,optind,nargv); + nonopt_start = optind - + (nonopt_end - nonopt_start); + nonopt_end = -1; + } + optind++; + + goto start; + } + if (nonopt_start != -1 && nonopt_end == -1) + nonopt_end = optind; + if (place[1] && *++place == '-') { + place++; + return -2; + } + } + if ((optchar = (int)*place++) == (int)':' || + (oli = strchr(options + (IGNORE_FIRST ? 1 : 0),optchar)) == NULL) { + + if (!*place) + ++optind; + if (PRINT_ERROR) + warnx(illoptchar,optchar); + optopt = optchar; + return BADCH; + } + if (optchar == 'W' && oli[1] == ';') { + + if (*place) + return -2; + + if (++optind >= nargc) { + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar,optchar); + optopt = optchar; + return BADARG; + } else + place = nargv[optind]; + + return -2; + } + if (*++oli != ':') { + if (!*place) + ++optind; + } else { + optarg = NULL; + if (*place) + optarg = place; + + else if (oli[1] != ':') { + if (++optind >= nargc) { + place = EMSG; + if (PRINT_ERROR) + warnx(recargchar,optchar); + optopt = optchar; + return BADARG; + } else + optarg = nargv[optind]; + } + place = EMSG; + ++optind; + } + + return optchar; +} + +#ifdef REPLACE_GETOPT + +int +getopt(nargc,nargv,options) + int nargc; + char * const *nargv; + const char *options; +{ + int retval; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + + if ((retval = getopt_internal(nargc,nargv,options)) == -2) { + ++optind; + + if (nonopt_end != -1) { + permute_args(nonopt_start,nonopt_end,optind,nargv); + optind -= nonopt_end - nonopt_start; + } + nonopt_start = nonopt_end = -1; + retval = -1; + } + return retval; +} +#endif + +int +getopt_long(nargc,nargv,options,long_options,idx) + int nargc; + char * const *nargv; + const char *options; + const struct option *long_options; + int *idx; +{ + int retval; + + _DIAGASSERT(nargv != NULL); + _DIAGASSERT(options != NULL); + _DIAGASSERT(long_options != NULL); + + if ((retval = getopt_internal(nargc,nargv,options)) == -2) { + char *current_argv,*has_equal; + size_t current_argv_len; + int i,match; + + current_argv = place; + match = -1; + + optind++; + place = EMSG; + + if (*current_argv == '\0') { + + if (nonopt_end != -1) { + permute_args(nonopt_start,nonopt_end,optind,nargv); + optind -= nonopt_end - nonopt_start; + } + nonopt_start = nonopt_end = -1; + return -1; + } + if ((has_equal = strchr(current_argv,'=')) != NULL) { + + current_argv_len = has_equal - current_argv; + has_equal++; + } else + current_argv_len = strlen(current_argv); + + for (i = 0; long_options[i].name; i++) { + + if (strncmp(current_argv,long_options[i].name,current_argv_len)) + continue; + + if (strlen(long_options[i].name) == + (unsigned)current_argv_len) { + + match = i; + break; + } + if (match == -1) + match = i; + else { + + if (PRINT_ERROR) + warnx(ambig,(int)current_argv_len,current_argv); + optopt = 0; + return BADCH; + } + } + if (match != -1) { + if (long_options[match].has_arg == no_argument + && has_equal) { + if (PRINT_ERROR) + warnx(noarg,(int)current_argv_len,current_argv); + + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + return BADARG; + } + if (long_options[match].has_arg == required_argument || + long_options[match].has_arg == optional_argument) { + if (has_equal) + optarg = has_equal; + else if (long_options[match].has_arg == + required_argument) { + + optarg = nargv[optind++]; + } + } + if ((long_options[match].has_arg == required_argument) + && (optarg == NULL)) { + + if (PRINT_ERROR) + warnx(recargstring,current_argv); + + if (long_options[match].flag == NULL) + optopt = long_options[match].val; + else + optopt = 0; + --optind; + return BADARG; + } + } else { + if (PRINT_ERROR) + warnx(illoptstring,current_argv); + optopt = 0; + return BADCH; + } + if (long_options[match].flag) { + *long_options[match].flag = long_options[match].val; + retval = 0; + } else + retval = long_options[match].val; + if (idx) + *idx = match; + } + return retval; +} diff --git a/reactos/tools/widl/proxy.c b/reactos/tools/widl/proxy.c index 699e073bc35..0d78f4a299d 100644 --- a/reactos/tools/widl/proxy.c +++ b/reactos/tools/widl/proxy.c @@ -485,14 +485,15 @@ static const statement_t * get_callas_source(const type_t * iface, const var_t * return NULL; } -static void write_proxy_procformatstring_offsets( const type_t *iface, int skip ) +static int write_proxy_procformatstring_offsets( const type_t *iface, int skip ) { const statement_t *stmt; + int i = 0; if (type_iface_get_inherit(iface)) - write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface)); + i = write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface)); else - return; + return 0; STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { @@ -512,7 +513,9 @@ static void write_proxy_procformatstring_offsets( const type_t *iface, int skip print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func)); else print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func)); + i++; } + return i; } static int write_proxy_methods(type_t *iface, int skip) @@ -645,7 +648,10 @@ 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++; - write_proxy_procformatstring_offsets( iface, 0 ); + if (write_proxy_procformatstring_offsets( iface, 0 ) == 0) + { + print_proxy( "0\n" ); + } indent--; print_proxy( "};\n\n" ); @@ -719,7 +725,10 @@ 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++; - write_stub_methods(iface, FALSE); + if (write_stub_methods(iface, FALSE) == 0) + { + fprintf(proxy, "0"); + } fprintf(proxy, "\n"); indent--; fprintf(proxy, "};\n\n"); diff --git a/reactos/tools/widl/typegen.c b/reactos/tools/widl/typegen.c index dfc5a505166..43196b0493a 100644 --- a/reactos/tools/widl/typegen.c +++ b/reactos/tools/widl/typegen.c @@ -4734,7 +4734,7 @@ 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 - fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size ); + fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name ); } if (add_retval && !is_void( rettype )) { diff --git a/reactos/tools/wpp/CMakeLists.txt b/reactos/tools/wpp/CMakeLists.txt index b8da62d8c35..bcd71b7b297 100644 --- a/reactos/tools/wpp/CMakeLists.txt +++ b/reactos/tools/wpp/CMakeLists.txt @@ -1,4 +1,11 @@ +if(MSVC) + add_definitions( + -Dsnprintf=_snprintf + -Dstrtoull=_strtoui64 + -Dstrtoll=_strtoi64) +endif() + list(APPEND SOURCE lex.yy.c preproc.c