23 #include "wine/port.h" 47 "Usage: widl [options...] infile.idl\n" 48 " or: widl [options...] --dlldata-only name1 [name2...]\n" 49 " --acf=file Use ACF file\n" 50 " -app_config Ignored, present for midl compatibility\n" 51 " -b arch Set the target architecture\n" 52 " -c Generate client stub\n" 53 " -d n Set debug level to 'n'\n" 54 " -D id[=val] Define preprocessor identifier id=val\n" 55 " -E Preprocess only\n" 56 " --help Display this help and exit\n" 57 " -h Generate headers\n" 58 " -H file Name of header file (default is infile.h)\n" 59 " -I path Set include search dir to path (multiple -I allowed)\n" 60 " --local-stubs=file Write empty stubs for call_as/local methods to file\n" 61 " -m32, -m64 Set the target architecture (Win32 or Win64)\n" 62 " -N Do not preprocess input\n" 63 " --oldnames Use old naming conventions\n" 64 " --oldtlb Use old typelib (SLTG) format\n" 65 " -o, --output=NAME Set the output file name\n" 66 " -Otype Type of stubs to generate (-Os, -Oi, -Oif)\n" 67 " -p Generate proxy\n" 68 " --prefix-all=p Prefix names of client stubs / server functions with 'p'\n" 69 " --prefix-client=p Prefix names of client stubs with 'p'\n" 70 " --prefix-server=p Prefix names of server functions with 'p'\n" 71 " -r Generate registration script\n" 72 " -robust Ignored, present for midl compatibility\n" 73 " --winrt Enable Windows Runtime mode\n" 74 " --ns_prefix Prefix namespaces with ABI namespace\n" 75 " -s Generate server stub\n" 76 " -t Generate typelib\n" 77 " -u Generate interface identifiers file\n" 78 " -V Print version and exit\n" 79 " -W Enable pedantic warnings\n" 80 " --win32, --win64 Set the target architecture (Win32 or Win64)\n" 81 " --win32-align n Set win32 structure alignment to 'n'\n" 82 " --win64-align n Set win64 structure alignment to 'n'\n" 83 "Debug level 'n' is a bitmask with following meaning:\n" 84 " * 0x01 Tell which resource is parsed (verbose mode)\n" 85 " * 0x02 Dump internal structures\n" 86 " * 0x04 Create a parser trace (yydebug=1)\n" 87 " * 0x08 Preprocessor messages\n" 88 " * 0x10 Preprocessor lex messages\n" 89 " * 0x20 Preprocessor yacc trace\n" 93 "Copyright 2002 Ove Kaaven\n";
98 #elif defined(TARGET_amd64) 100 #elif defined(TARGET_ppc) 102 #elif defined(TARGET_arm) 104 #elif defined(TARGET_arm64) 107 #error Unsupported CPU 184 "b:cC:d:D:EhH:I:m:No:O:pP:rsS:tT:uU:VW";
195 {
"output", 0,
NULL,
'o' },
200 {
"target", 0,
NULL,
'b' },
228 if (slash)
name = slash + 1;
269 char version_str[11];
307 if (!(
p =
strchr( spec,
'-' )))
error(
"Invalid target specification '%s'\n",
target );
309 for (
i = 0;
i <
sizeof(cpu_names)/
sizeof(cpu_names[0]);
i++)
318 error(
"Unrecognized CPU '%s'\n", spec );
342 fprintf(fp,
"#ifdef __cplusplus\n");
343 fprintf(fp,
"extern \"C\" {\n");
349 fprintf(fp,
"#ifdef __cplusplus\n");
387 fprintf(dlldata,
"- Do not edit ***/\n\n");
388 if (define_proxy_delegation)
389 fprintf(dlldata,
"#define PROXY_DELEGATION\n");
391 fprintf(dlldata,
"#ifdef __REACTOS__\n");
392 fprintf(dlldata,
"#define WIN32_NO_STATUS\n");
393 fprintf(dlldata,
"#define WIN32_LEAN_AND_MEAN\n");
394 fprintf(dlldata,
"#endif\n\n");
396 fprintf(dlldata,
"#include <objbase.h>\n");
397 fprintf(dlldata,
"#include <rpcproxy.h>\n\n");
401 fprintf(dlldata,
"EXTERN_PROXY_FILE(%s)\n",
node->filename);
403 fprintf(dlldata,
"\nPROXYFILE_LIST_START\n");
404 fprintf(dlldata,
"/* Start of list */\n");
406 fprintf(dlldata,
" REFERENCE_PROXY_FILE(%s),\n",
node->filename);
407 fprintf(dlldata,
"/* End of list */\n");
408 fprintf(dlldata,
"PROXYFILE_LIST_END\n\n");
410 fprintf(dlldata,
"DLLDATA_ROUTINES(aProxyFileList, GET_DLL_CLSID)\n\n");
425 int define_proxy_delegation = 0;
436 static const char marker[] =
"REFERENCE_PROXY_FILE";
437 static const char delegation_define[] =
"#define PROXY_DELEGATION";
449 while (*
end && *
end !=
')')
458 }
else if (!define_proxy_delegation &&
strncmp(
start, delegation_define,
sizeof(delegation_define)-1)) {
459 define_proxy_delegation = 1;
485 fprintf(
f,
"MIDL_DEFINE_GUID(%s, %s_%s, 0x%08x, 0x%04x, 0x%04x, 0x%02x,0x%02x, 0x%02x," 486 "0x%02x,0x%02x,0x%02x,0x%02x,0x%02x);\n",
508 if (
type->details.iface->async_iface)
560 fprintf(
idfile,
"#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \\\n");
561 fprintf(
idfile,
" DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)\n\n");
565 fprintf(
idfile,
"#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \\\n");
566 fprintf(
idfile,
" EXTERN_C const type DECLSPEC_SELECTANY name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}\n\n");
570 fprintf(
idfile,
"#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \\\n");
571 fprintf(
idfile,
" const type DECLSPEC_SELECTANY name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}\n\n");
590 char *output_name =
NULL;
644 error(
"Packing must be one of 2, 4 or 8\n");
649 error(
"Packing must be one of 2, 4 or 8\n");
756 #ifdef DEFAULT_INCLUDE_DIR 900 chat(
"Starting preprocess\n");
912 error(
"Could not generate a temp name from %s\n",
name);
916 error(
"Could not open fd %s for writing\n",
name);
static char * idfile_name
int getopt_long_only(optarg_ctx *o, int argc, WCHAR *const *argv, const WCHAR *shortopts, const struct option *longopts, int *longind)
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
static UCHAR ULONG UCHAR ULONG UCHAR * output
const char * prefix_client
char * strcat(char *DstString, const char *SrcString)
ACPI_SIZE strlen(const char *String)
enum stub_mode get_stub_mode(void)
GLint GLint GLint GLint GLint x
static enum stub_mode stub_mode
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
static int preprocess_only
static void exit_on_signal(int sig)
const char * strerror(int err)
int __cdecl atexit(void(__cdecl *)(void))
void write_id_data(const statement_list_t *stmts)
void start_cplusplus_guard(FILE *fp)
union _statement_t::@4814 u
static char * make_token(const char *name)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
static const struct option long_options[]
int wpp_parse(const char *input, FILE *output)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
static const WCHAR version[]
static void set_target(const char *target)
static char * eat_space(char *s)
static char * dup_basename_token(const char *name, const char *ext)
static void write_dlldata_list(struct list *filenames, int define_proxy_delegation)
int main(int argc, char *argv[])
static void write_id_guid(FILE *f, const char *type, const char *guid_prefix, const char *name, const UUID *uuid)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
static enum type_type type_get_type(const type_t *type)
int wpp_add_include_path(const char *path)
void wpp_set_debug(int lex_debug, int parser_debug, int msg_debug)
void end_cplusplus_guard(FILE *fp)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
static void set_everything(int x)
static void rm_tempfile(void)
int wpp_add_define(const char *name, const char *value)
#define DEBUGLEVEL_PPTRACE
GLsizeiptr const GLvoid GLenum usage
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
unsigned int pointer_size
const attr_list_t * attrs
static unsigned __int64 next
static void write_id_data_stmts(const statement_list_t *stmts)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static void add_widl_version_define(void)
static const char version_string[]
_Check_return_ _CRTIMP FILE *__cdecl fdopen(_In_ int _FileHandle, _In_z_ const char *_Format)
int wpp_add_cmdline_define(const char *value)
int mkstemps(char *template, int suffix_len)
char * strchr(const char *String, int ch)
void write_dlldata(const statement_list_t *stmts)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
char * strcpy(char *DstString, const char *SrcString)
const char * prefix_server
int strcmp(const char *String1, const char *String2)
_CRTIMP void __cdecl setbuf(_Inout_ FILE *_File, _Inout_updates_opt_(BUFSIZ) _Post_readable_size_(0) char *_Buffer)
static void free_filename_nodes(struct list *list)
static const char short_options[]
GLuint GLuint GLsizei GLenum type
char * xstrdup(const char *s)
static void add_filename_node(struct list *list, const char *name)
GLuint const GLchar * name