mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[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
This commit is contained in:
parent
d1f163d021
commit
c3be8a39d4
18 changed files with 478 additions and 107 deletions
|
@ -66,7 +66,7 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
export(TARGETS widl gendib cabman cdmake mkhive obj2bin spec2def geninc rsym mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
export(TARGETS widl gendib cabman cdmake mkhive obj2bin spec2def geninc rsym mkshelllink FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
|
||||||
else()
|
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()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
@ -169,11 +169,8 @@ else()
|
||||||
include(cmake/CMakeMacros.cmake)
|
include(cmake/CMakeMacros.cmake)
|
||||||
|
|
||||||
# IDL macros for widl/midl
|
# IDL macros for widl/midl
|
||||||
if (MSVC)
|
# We're using widl now for both MSVC and GCC builds
|
||||||
include(cmake/midl-support.cmake)
|
|
||||||
else()
|
|
||||||
include(cmake/widl-support.cmake)
|
include(cmake/widl-support.cmake)
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC AND USE_WDK_HEADERS)
|
if(MSVC AND USE_WDK_HEADERS)
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
|
@ -12,7 +12,7 @@ set_entrypoint(idndl 0)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_target_compile_flags(idndl "-fno-exceptions -fno-rtti")
|
add_target_compile_flags(idndl "-fno-exceptions -fno-rtti")
|
||||||
endif(NOT MSVC)
|
endif()
|
||||||
|
|
||||||
add_importlibs(idndl kernel32)
|
add_importlibs(idndl kernel32)
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
add_definitions(-D__WINESRC__)
|
add_definitions(-D__WINESRC__)
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||||
|
|
||||||
set_rc_compiler()
|
|
||||||
|
|
||||||
spec2def(itss.dll itss.spec)
|
spec2def(itss.dll itss.spec)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
|
@ -23,9 +21,8 @@ add_library(itss SHARED
|
||||||
|
|
||||||
set_module_type(itss win32dll)
|
set_module_type(itss win32dll)
|
||||||
target_link_libraries(itss uuid wine)
|
target_link_libraries(itss uuid wine)
|
||||||
if(MSVC)
|
|
||||||
target_link_libraries(itss itss_guid)
|
if(NOT MSVC)
|
||||||
else()
|
|
||||||
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
|
# FIXME: http://www.cmake.org/Bug/view.php?id=12998
|
||||||
#allow_warnings(itss)
|
#allow_warnings(itss)
|
||||||
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error")
|
set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error")
|
||||||
|
|
|
@ -10,8 +10,6 @@ add_definitions(
|
||||||
|
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||||
|
|
||||||
set_rc_compiler()
|
|
||||||
|
|
||||||
spec2def(jscript.dll jscript.spec)
|
spec2def(jscript.dll jscript.spec)
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
|
@ -38,26 +36,11 @@ list(APPEND SOURCE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/jscript.def)
|
${CMAKE_CURRENT_BINARY_DIR}/jscript.def)
|
||||||
|
|
||||||
add_library(jscript SHARED ${SOURCE})
|
add_library(jscript SHARED ${SOURCE})
|
||||||
|
|
||||||
set_module_type(jscript win32dll)
|
set_module_type(jscript win32dll)
|
||||||
|
|
||||||
target_link_libraries(jscript wine)
|
target_link_libraries(jscript wine)
|
||||||
if(MSVC)
|
add_importlibs(jscript user32 ole32 oleaut32 advapi32 msvcrt kernel32 ntdll)
|
||||||
target_link_libraries(jscript uuid)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_importlibs(jscript
|
|
||||||
msvcrt
|
|
||||||
user32
|
|
||||||
ole32
|
|
||||||
oleaut32
|
|
||||||
advapi32
|
|
||||||
kernel32
|
|
||||||
ntdll)
|
|
||||||
|
|
||||||
add_pch(jscript jscript.h)
|
add_pch(jscript jscript.h)
|
||||||
# jsglobal.tlb needs stdole2.tlb
|
# jsglobal.tlb needs stdole2.tlb
|
||||||
add_dependencies(jscript stdole2)
|
add_dependencies(jscript stdole2)
|
||||||
add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all)
|
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)
|
set_source_files_properties(rsrc.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/jsglobal.tlb)
|
||||||
|
|
|
@ -20,13 +20,7 @@ list(APPEND SOURCE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/mscoree.def)
|
${CMAKE_CURRENT_BINARY_DIR}/mscoree.def)
|
||||||
|
|
||||||
add_library(mscoree SHARED ${SOURCE})
|
add_library(mscoree SHARED ${SOURCE})
|
||||||
|
|
||||||
set_module_type(mscoree win32dll)
|
set_module_type(mscoree win32dll)
|
||||||
target_link_libraries(mscoree wine uuid)
|
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_importlibs(mscoree dbghelp advapi32 shell32 ole32 shlwapi msvcrt kernel32 ntdll)
|
||||||
add_cd_file(TARGET mscoree DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET mscoree DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -9,12 +9,10 @@ add_definitions(
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_flags("/FIwine/typeof.h /FImsvc.h")
|
add_compile_flags("/FIwine/typeof.h /FImsvc.h")
|
||||||
endif(MSVC)
|
endif()
|
||||||
|
|
||||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||||
|
|
||||||
set_rc_compiler()
|
|
||||||
|
|
||||||
spec2def(msxml3.dll msxml3.spec)
|
spec2def(msxml3.dll msxml3.spec)
|
||||||
|
|
||||||
add_typelib(msxml3_v1.idl)
|
add_typelib(msxml3_v1.idl)
|
||||||
|
@ -50,43 +48,12 @@ list(APPEND SOURCE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c
|
${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/msxml3.def)
|
${CMAKE_CURRENT_BINARY_DIR}/msxml3.def)
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
list(APPEND SOURCE msvc_uuid.c)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(msxml3 SHARED ${SOURCE})
|
add_library(msxml3 SHARED ${SOURCE})
|
||||||
|
|
||||||
set_module_type(msxml3 win32dll)
|
set_module_type(msxml3 win32dll)
|
||||||
|
|
||||||
set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msxml3_v1.tlb)
|
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
|
add_importlibs(msxml3 urlmon wininet ws2_32 comctl32 shell32 shlwapi cabinet oleaut32 ole32 version user32 gdi32 advapi32 msvcrt kernel32 ntdll)
|
||||||
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)
|
|
||||||
|
|
||||||
# msxml3_v1.tlb needs stdole2.tlb
|
# msxml3_v1.tlb needs stdole2.tlb
|
||||||
add_dependencies(msxml3 stdole2)
|
add_dependencies(msxml3 stdole2)
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
|
|
||||||
#define INITGUID
|
|
||||||
#include <guiddef.h>
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
|
@ -70,10 +70,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
|
|
||||||
#define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0]))
|
#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.
|
* This section defines variables internal to the COM module.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,15 +13,7 @@ list(APPEND SOURCE
|
||||||
|
|
||||||
add_library(sxs SHARED ${SOURCE})
|
add_library(sxs SHARED ${SOURCE})
|
||||||
set_module_type(sxs win32dll ENTRYPOINT 0 )
|
set_module_type(sxs win32dll ENTRYPOINT 0 )
|
||||||
|
|
||||||
target_link_libraries(sxs wine)
|
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_importlibs(sxs oleaut32 ole32 kernel32 ntdll)
|
||||||
add_dependencies(sxs psdk)
|
add_dependencies(sxs psdk)
|
||||||
|
|
||||||
add_cd_file(TARGET sxs DESTINATION reactos/system32 FOR all)
|
add_cd_file(TARGET sxs DESTINATION reactos/system32 FOR all)
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#include <guiddef.h>
|
|
||||||
const CLSID CLSID_DOMDocument2 = {0xf6d90f11, 0x9c73, 0x11d3, {0xb3, 0x2e, 0x00,0xc0, 0x4f, 0x99, 0x0b, 0xb4}};
|
|
|
@ -27,9 +27,5 @@ DEFINE_GUID(CLSID_StdHlinkBrowseContext,
|
||||||
0x79eac9d1, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b);
|
0x79eac9d1, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b);
|
||||||
DEFINE_GUID(CLSID_IID_IExtensionServices,
|
DEFINE_GUID(CLSID_IID_IExtensionServices,
|
||||||
0x79eac9cb, 0xbaf9, 0x11ce, 0x8c, 0x82, 0x00, 0xaa,0x00,0x4b,0xa9,0x0b);
|
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
|
#endif
|
||||||
|
|
|
@ -153,7 +153,9 @@ struct statfs;
|
||||||
|
|
||||||
/* Constructor functions */
|
/* Constructor functions */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef _MSC_VER
|
||||||
|
# define DECL_GLOBAL_CONSTRUCTOR(func) /* nothing */
|
||||||
|
#elif defined(__GNUC__)
|
||||||
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
# define DECL_GLOBAL_CONSTRUCTOR(func) \
|
||||||
static void func(void) __attribute__((constructor)); \
|
static void func(void) __attribute__((constructor)); \
|
||||||
static void func(void)
|
static void func(void)
|
||||||
|
|
|
@ -14,9 +14,8 @@ add_subdirectory(obj2bin)
|
||||||
add_subdirectory(spec2def)
|
add_subdirectory(spec2def)
|
||||||
add_subdirectory(unicode)
|
add_subdirectory(unicode)
|
||||||
add_subdirectory(mkshelllink)
|
add_subdirectory(mkshelllink)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_subdirectory(rsym)
|
|
||||||
add_subdirectory(widl)
|
add_subdirectory(widl)
|
||||||
add_subdirectory(wpp)
|
add_subdirectory(wpp)
|
||||||
|
if(NOT MSVC)
|
||||||
|
add_subdirectory(rsym)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(-Dsnprintf=_snprintf)
|
||||||
|
list(APPEND SOURCE getopt.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
client.c
|
client.c
|
||||||
expr.c
|
expr.c
|
||||||
|
|
436
reactos/tools/widl/getopt.c
Normal file
436
reactos/tools/widl/getopt.c
Normal file
|
@ -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 <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
|
@ -485,14 +485,15 @@ static const statement_t * get_callas_source(const type_t * iface, const var_t *
|
||||||
return NULL;
|
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;
|
const statement_t *stmt;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
if (type_iface_get_inherit(iface))
|
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
|
else
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
|
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));
|
print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func));
|
||||||
else
|
else
|
||||||
print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func));
|
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)
|
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( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name );
|
||||||
print_proxy( "{\n" );
|
print_proxy( "{\n" );
|
||||||
indent++;
|
indent++;
|
||||||
write_proxy_procformatstring_offsets( iface, 0 );
|
if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
|
||||||
|
{
|
||||||
|
print_proxy( "0\n" );
|
||||||
|
}
|
||||||
indent--;
|
indent--;
|
||||||
print_proxy( "};\n\n" );
|
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( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
|
||||||
print_proxy( "{\n");
|
print_proxy( "{\n");
|
||||||
indent++;
|
indent++;
|
||||||
write_stub_methods(iface, FALSE);
|
if (write_stub_methods(iface, FALSE) == 0)
|
||||||
|
{
|
||||||
|
fprintf(proxy, "0");
|
||||||
|
}
|
||||||
fprintf(proxy, "\n");
|
fprintf(proxy, "\n");
|
||||||
indent--;
|
indent--;
|
||||||
fprintf(proxy, "};\n\n");
|
fprintf(proxy, "};\n\n");
|
||||||
|
|
|
@ -4734,7 +4734,7 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun
|
||||||
if (align >= pointer_size)
|
if (align >= pointer_size)
|
||||||
fprintf( file, "%s;\n", arg->name );
|
fprintf( file, "%s;\n", arg->name );
|
||||||
else
|
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 ))
|
if (add_retval && !is_void( rettype ))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(
|
||||||
|
-Dsnprintf=_snprintf
|
||||||
|
-Dstrtoull=_strtoui64
|
||||||
|
-Dstrtoll=_strtoi64)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND SOURCE
|
list(APPEND SOURCE
|
||||||
lex.yy.c
|
lex.yy.c
|
||||||
preproc.c
|
preproc.c
|
||||||
|
|
Loading…
Reference in a new issue