ReactOS  0.4.13-dev-464-g6b95727
widl.c File Reference
#include "config.h"
#include "wine/port.h"
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <signal.h>
#include "widl.h"
#include "utils.h"
#include "parser.h"
#include "wine/wpp.h"
#include "header.h"
Include dependency graph for widl.c:

Go to the source code of this file.

Classes

struct  filename_node_t
 

Enumerations

enum  {
  OLDNAMES_OPTION = CHAR_MAX + 1, ACF_OPTION, APP_CONFIG_OPTION, DLLDATA_OPTION,
  DLLDATA_ONLY_OPTION, LOCAL_STUBS_OPTION, OLD_TYPELIB_OPTION, PREFIX_ALL_OPTION,
  PREFIX_CLIENT_OPTION, PREFIX_SERVER_OPTION, PRINT_HELP, RT_NS_PREFIX,
  RT_OPTION, ROBUST_OPTION, WIN32_OPTION, WIN64_OPTION,
  WIN32_ALIGN_OPTION, WIN64_ALIGN_OPTION
}
 

Functions

static void rm_tempfile (void)
 
enum stub_mode get_stub_mode (void)
 
static charmake_token (const char *name)
 
static chardup_basename_token (const char *name, const char *ext)
 
static void add_widl_version_define (void)
 
static void set_target (const char *target)
 
static void exit_on_signal (int sig)
 
static void set_everything (int x)
 
void start_cplusplus_guard (FILE *fp)
 
void end_cplusplus_guard (FILE *fp)
 
static void add_filename_node (struct list *list, const char *name)
 
static void free_filename_nodes (struct list *list)
 
static void write_dlldata_list (struct list *filenames, int define_proxy_delegation)
 
static chareat_space (char *s)
 
void write_dlldata (const statement_list_t *stmts)
 
static void write_id_guid (FILE *f, const char *type, const char *guid_prefix, const char *name, const UUID *uuid)
 
static void write_id_data_stmts (const statement_list_t *stmts)
 
void write_id_data (const statement_list_t *stmts)
 
int main (int argc, char *argv[])
 

Variables

static const char usage []
 
static const char version_string []
 
int debuglevel = DEBUGLEVEL_NONE
 
int parser_debug
 
int yy_flex_debug
 
int pedantic = 0
 
int do_everything = 1
 
static int preprocess_only = 0
 
int do_header = 0
 
int do_typelib = 0
 
int do_old_typelib = 0
 
int do_proxies = 0
 
int do_client = 0
 
int do_server = 0
 
int do_regscript = 0
 
int do_idfile = 0
 
int do_dlldata = 0
 
static int no_preprocess = 0
 
int old_names = 0
 
int win32_packing = 8
 
int win64_packing = 8
 
int winrt_mode = 0
 
int use_abi_namespace = 0
 
static enum stub_mode stub_mode = MODE_Os
 
charinput_name
 
charinput_idl_name
 
characf_name
 
charheader_name
 
charlocal_stubs_name
 
charheader_token
 
chartypelib_name
 
chardlldata_name
 
charproxy_name
 
charproxy_token
 
charclient_name
 
charclient_token
 
charserver_name
 
charserver_token
 
charregscript_name
 
charregscript_token
 
static charidfile_name
 
chartemp_name
 
const charprefix_client = ""
 
const charprefix_server = ""
 
int line_number = 1
 
static FILEidfile
 
unsigned int pointer_size = 0
 
time_t now
 
static const char short_options []
 
static const struct option long_options []
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OLDNAMES_OPTION 
ACF_OPTION 
APP_CONFIG_OPTION 
DLLDATA_OPTION 
DLLDATA_ONLY_OPTION 
LOCAL_STUBS_OPTION 
OLD_TYPELIB_OPTION 
PREFIX_ALL_OPTION 
PREFIX_CLIENT_OPTION 
PREFIX_SERVER_OPTION 
PRINT_HELP 
RT_NS_PREFIX 
RT_OPTION 
ROBUST_OPTION 
WIN32_OPTION 
WIN64_OPTION 
WIN32_ALIGN_OPTION 
WIN64_ALIGN_OPTION 

Definition at line 162 of file widl.c.

Function Documentation

◆ add_filename_node()

static void add_filename_node ( struct list list,
const char name 
)
static

Definition at line 360 of file widl.c.

361 {
362  filename_node_t *node = xmalloc(sizeof *node);
363  node->filename = dup_basename( name, ".idl" );
364  list_add_tail(list, &node->link);
365 }
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
void * xmalloc(int size)
Definition: uimain.c:747
Definition: _list.h:228
Definition: name.c:36
char * dup_basename(const char *name, const char *ext)
Definition: utils.c:143
Definition: dlist.c:348

Referenced by main(), and write_dlldata().

◆ add_widl_version_define()

static void add_widl_version_define ( void  )
static

Definition at line 247 of file widl.c.

248 {
249  unsigned int version;
250  const char *p = PACKAGE_VERSION;
251 
252  /* major */
253  version = atoi(p) * 0x10000;
254  p = strchr(p, '.');
255 
256  /* minor */
257  if (p)
258  {
259  version += atoi(p + 1) * 0x100;
260  p = strchr(p + 1, '.');
261  }
262 
263  /* build */
264  if (p)
265  version += atoi(p + 1);
266 
267  if (version != 0)
268  {
269  char version_str[11];
270  snprintf(version_str, sizeof(version_str), "0x%x", version);
271  wpp_add_define("__WIDL__", version_str);
272  }
273  else
274  wpp_add_define("__WIDL__", NULL);
275 }
#define PACKAGE_VERSION
Definition: config.h:835
int wpp_add_define(const char *name, const char *value)
Definition: wpp.c:93
#define snprintf
Definition: wintirpc.h:48
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
char * strchr(const char *String, int ch)
Definition: utclib.c:501
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by main().

◆ dup_basename_token()

static char* dup_basename_token ( const char name,
const char ext 
)
static

Definition at line 239 of file widl.c.

240 {
241  char *p, *ret = dup_basename( name, ext );
242  /* map invalid characters to '_' */
243  for (p = ret; *p; p++) if (!isalnum(*p)) *p = '_';
244  return ret;
245 }
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
char ext[3]
Definition: mkdosfs.c:358
int ret
Definition: name.c:36
char * dup_basename(const char *name, const char *ext)
Definition: utils.c:143
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by main().

◆ eat_space()

static char* eat_space ( char s)
static

Definition at line 415 of file widl.c.

416 {
417  while (isspace((unsigned char) *s))
418  ++s;
419  return s;
420 }
#define isspace(c)
Definition: acclib.h:69
GLdouble s
Definition: gl.h:2039

Referenced by write_dlldata().

◆ end_cplusplus_guard()

void end_cplusplus_guard ( FILE fp)

Definition at line 347 of file widl.c.

348 {
349  fprintf(fp, "#ifdef __cplusplus\n");
350  fprintf(fp, "}\n");
351  fprintf(fp, "#endif\n\n");
352 }
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)

Referenced by write_dlldata_list(), write_header(), and write_id_data().

◆ exit_on_signal()

static void exit_on_signal ( int  sig)
static

Definition at line 322 of file widl.c.

323 {
324  exit(1); /* this will call the atexit functions */
325 }
void exit(int exitcode)
Definition: _exit.c:33

Referenced by main().

◆ free_filename_nodes()

static void free_filename_nodes ( struct list list)
static

Definition at line 367 of file widl.c.

368 {
371  list_remove(&node->link);
372  free(node->filename);
373  free(node);
374  }
375 }
#define free
Definition: debug_ros.c:5
struct node node
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
Definition: _list.h:228
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
const WCHAR * link
Definition: db.cpp:985
Definition: dlist.c:348

Referenced by main(), and write_dlldata().

◆ get_stub_mode()

enum stub_mode get_stub_mode ( void  )

Definition at line 211 of file widl.c.

212 {
213  /* old-style interpreted stubs are not supported on 64-bit */
214  if (stub_mode == MODE_Oi && pointer_size == 8) return MODE_Oif;
215  return stub_mode;
216 }
static enum stub_mode stub_mode
Definition: widl.c:131
Definition: widl.h:88
unsigned int pointer_size
Definition: widl.c:158
stub_mode
Definition: widl.h:85
Definition: widl.h:89

Referenced by gen_proxy(), is_interpreted_func(), need_inline_stubs(), need_proxy_and_inline_stubs(), write_client_call_routine(), write_dispatchtable(), write_nonsimple_pointer(), write_proc_func_header(), write_procformatstring_func(), write_proxy(), write_proxy_routines(), write_serialize_function(), write_simple_pointer(), write_stub_methods(), write_stubdesc(), and write_stubdescriptor().

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 585 of file widl.c.

586 {
587  int optc;
588  int ret = 0;
589  int opti = 0;
590  char *output_name = NULL;
591 
594 #ifdef SIGHUP
596 #endif
597 
598  now = time(NULL);
599 
600  while((optc = getopt_long_only(argc, argv, short_options, long_options, &opti)) != EOF) {
601  switch(optc) {
602  case DLLDATA_OPTION:
604  break;
605  case DLLDATA_ONLY_OPTION:
606  do_everything = 0;
607  do_dlldata = 1;
608  break;
609  case LOCAL_STUBS_OPTION:
610  do_everything = 0;
612  break;
613  case OLDNAMES_OPTION:
614  old_names = 1;
615  break;
616  case PREFIX_ALL_OPTION:
619  break;
622  break;
625  break;
626  case PRINT_HELP:
627  fprintf(stderr, "%s", usage);
628  return 0;
629  case RT_OPTION:
630  winrt_mode = 1;
631  break;
632  case RT_NS_PREFIX:
633  use_abi_namespace = 1;
634  break;
635  case WIN32_OPTION:
636  pointer_size = 4;
637  break;
638  case WIN64_OPTION:
639  pointer_size = 8;
640  break;
641  case WIN32_ALIGN_OPTION:
643  if(win32_packing != 2 && win32_packing != 4 && win32_packing != 8)
644  error("Packing must be one of 2, 4 or 8\n");
645  break;
646  case WIN64_ALIGN_OPTION:
648  if(win64_packing != 2 && win64_packing != 4 && win64_packing != 8)
649  error("Packing must be one of 2, 4 or 8\n");
650  break;
651  case ACF_OPTION:
653  break;
654  case APP_CONFIG_OPTION:
655  /* widl does not distinguish between app_mode and default mode,
656  but we ignore this option for midl compatibility */
657  break;
658  case ROBUST_OPTION:
659  /* FIXME: Support robust option */
660  break;
661  case 'b':
662  set_target( optarg );
663  break;
664  case 'c':
665  do_everything = 0;
666  do_client = 1;
667  break;
668  case 'C':
670  break;
671  case 'd':
672  debuglevel = strtol(optarg, NULL, 0);
673  break;
674  case 'D':
676  break;
677  case 'E':
678  do_everything = 0;
679  preprocess_only = 1;
680  break;
681  case 'h':
682  do_everything = 0;
683  do_header = 1;
684  break;
685  case 'H':
687  break;
688  case 'I':
690  break;
691  case 'm':
692  if (!strcmp( optarg, "32" )) pointer_size = 4;
693  else if (!strcmp( optarg, "64" )) pointer_size = 8;
694  break;
695  case 'N':
696  no_preprocess = 1;
697  break;
698  case 'o':
699  output_name = xstrdup(optarg);
700  break;
701  case 'O':
702  if (!strcmp( optarg, "s" )) stub_mode = MODE_Os;
703  else if (!strcmp( optarg, "i" )) stub_mode = MODE_Oi;
704  else if (!strcmp( optarg, "ic" )) stub_mode = MODE_Oif;
705  else if (!strcmp( optarg, "if" )) stub_mode = MODE_Oif;
706  else if (!strcmp( optarg, "icf" )) stub_mode = MODE_Oif;
707  else error( "Invalid argument '-O%s'\n", optarg );
708  break;
709  case 'p':
710  do_everything = 0;
711  do_proxies = 1;
712  break;
713  case 'P':
715  break;
716  case 'r':
717  do_everything = 0;
718  do_regscript = 1;
719  break;
720  case 's':
721  do_everything = 0;
722  do_server = 1;
723  break;
724  case 'S':
726  break;
727  case 't':
728  do_everything = 0;
729  do_typelib = 1;
730  break;
731  case OLD_TYPELIB_OPTION:
732  do_old_typelib = 1;
733  break;
734  case 'T':
736  break;
737  case 'u':
738  do_everything = 0;
739  do_idfile = 1;
740  break;
741  case 'U':
743  break;
744  case 'V':
745  printf("%s", version_string);
746  return 0;
747  case 'W':
748  pedantic = 1;
749  break;
750  default:
751  fprintf(stderr, "%s", usage);
752  return 1;
753  }
754  }
755 
756 #ifdef DEFAULT_INCLUDE_DIR
757  wpp_add_include_path(DEFAULT_INCLUDE_DIR);
758 #endif
759 
760  switch (target_cpu)
761  {
762  case CPU_x86:
763  if (pointer_size == 8) target_cpu = CPU_x86_64;
764  else pointer_size = 4;
765  break;
766  case CPU_x86_64:
767  if (pointer_size == 4) target_cpu = CPU_x86;
768  else pointer_size = 8;
769  break;
770  case CPU_ARM64:
771  if (pointer_size == 4) error( "Cannot build 32-bit code for this CPU\n" );
772  pointer_size = 8;
773  break;
774  default:
775  if (pointer_size == 8) error( "Cannot build 64-bit code for this CPU\n" );
776  pointer_size = 4;
777  break;
778  }
779 
780  /* if nothing specified, try to guess output type from the output file name */
781  if (output_name && do_everything && !do_header && !do_typelib && !do_proxies &&
783  {
784  do_everything = 0;
785  if (strendswith( output_name, ".h" )) do_header = 1;
786  else if (strendswith( output_name, ".tlb" )) do_typelib = 1;
787  else if (strendswith( output_name, "_p.c" )) do_proxies = 1;
788  else if (strendswith( output_name, "_c.c" )) do_client = 1;
789  else if (strendswith( output_name, "_s.c" )) do_server = 1;
790  else if (strendswith( output_name, "_i.c" )) do_idfile = 1;
791  else if (strendswith( output_name, "_r.res" )) do_regscript = 1;
792  else if (strendswith( output_name, "_t.res" )) do_typelib = 1;
793  else if (strendswith( output_name, "dlldata.c" )) do_dlldata = 1;
794  else do_everything = 1;
795  }
796 
797  if(do_everything) {
799  }
800 
801  if (!output_name) output_name = dup_basename(input_name, ".idl");
802 
805  {
806  if (do_header) header_name = output_name;
807  else if (do_typelib) typelib_name = output_name;
808  else if (do_proxies) proxy_name = output_name;
809  else if (do_client) client_name = output_name;
810  else if (do_server) server_name = output_name;
811  else if (do_regscript) regscript_name = output_name;
812  else if (do_idfile) idfile_name = output_name;
813  else if (do_dlldata) dlldata_name = output_name;
814  }
815 
816  if (!dlldata_name && do_dlldata)
817  dlldata_name = xstrdup("dlldata.c");
818 
819  if(optind < argc) {
820  if (do_dlldata && !do_everything) {
821  struct list filenames = LIST_INIT(filenames);
822  for ( ; optind < argc; ++optind)
823  add_filename_node(&filenames, argv[optind]);
824 
825  write_dlldata_list(&filenames, 0 /* FIXME */ );
826  free_filename_nodes(&filenames);
827  return 0;
828  }
829  else if (optind != argc - 1) {
830  fprintf(stderr, "%s", usage);
831  return 1;
832  }
833  else
835  }
836  else {
837  fprintf(stderr, "%s", usage);
838  return 1;
839  }
840 
841  if(debuglevel)
842  {
843  setbuf(stdout, NULL);
844  setbuf(stderr, NULL);
845  }
846 
849 
852  (debuglevel & DEBUGLEVEL_PPMSG) != 0 );
853 
854  if (!header_name) {
856  strcat(header_name, ".h");
857  }
858 
859  if (!typelib_name && do_typelib) {
861  strcat(typelib_name, ".tlb");
862  }
863 
864  if (!proxy_name && do_proxies) {
866  strcat(proxy_name, "_p.c");
867  }
868 
869  if (!client_name && do_client) {
871  strcat(client_name, "_c.c");
872  }
873 
874  if (!server_name && do_server) {
876  strcat(server_name, "_s.c");
877  }
878 
879  if (!regscript_name && do_regscript) {
881  strcat(regscript_name, "_r.rgs");
882  }
883 
884  if (!idfile_name && do_idfile) {
886  strcat(idfile_name, "_i.c");
887  }
888 
893 
895  wpp_add_define("_WIN32", NULL);
896 
898  if (!no_preprocess)
899  {
900  chat("Starting preprocess\n");
901 
902  if (!preprocess_only)
903  {
904  FILE *output;
905  int fd;
906  char *name = xmalloc( strlen(header_name) + 8 );
907 
908  strcpy( name, header_name );
909  strcat( name, ".XXXXXX" );
910 
911  if ((fd = mkstemps( name, 0 )) == -1)
912  error("Could not generate a temp name from %s\n", name);
913 
914  temp_name = name;
915  if (!(output = fdopen(fd, "wt")))
916  error("Could not open fd %s for writing\n", name);
917 
919  fclose( output );
920  }
921  else
922  {
924  }
925 
926  if(ret) exit(1);
927  if(preprocess_only) exit(0);
928  if(!(parser_in = fopen(temp_name, "r"))) {
929  fprintf(stderr, "Could not open %s for input\n", temp_name);
930  return 1;
931  }
932  }
933  else {
934  if(!(parser_in = fopen(input_name, "r"))) {
935  fprintf(stderr, "Could not open %s for input\n", input_name);
936  return 1;
937  }
938  }
939 
941 
942  init_types();
943  ret = parser_parse();
944 
945  fclose(parser_in);
946 
947  if(ret) {
948  exit(1);
949  }
950 
951  /* Everything has been done successfully, don't delete any files. */
954 
955  return 0;
956 }
static int argc
Definition: ServiceArgs.c:12
static char * idfile_name
Definition: widl.c:149
int getopt_long_only(optarg_ctx *o, int argc, WCHAR *const *argv, const WCHAR *shortopts, const struct option *longopts, int *longind)
int parser_debug
Definition: widl.c:111
#define TRUE
Definition: types.h:120
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
int do_client
Definition: widl.c:120
const char * prefix_client
Definition: widl.c:151
#define error(str)
Definition: mkdosfs.c:1605
Definition: widl.h:80
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
int optind
Definition: getopt.c:47
char * server_token
Definition: widl.c:146
char * proxy_token
Definition: widl.c:142
Definition: widl.h:80
char * temp_name
Definition: widl.c:150
int wpp_add_define(const char *name, const char *value)
Definition: wpp.c:93
int do_server
Definition: widl.c:121
static int fd
Definition: io.c:51
int win32_packing
Definition: widl.c:127
#define SIGINT
Definition: signal.h:23
__u16 time
Definition: mkdosfs.c:366
static int preprocess_only
Definition: widl.c:115
#define argv
Definition: mplay32.c:18
static void exit_on_signal(int sig)
Definition: widl.c:322
char * regscript_token
Definition: widl.c:148
char * header_token
Definition: widl.c:138
FILE * stdout
int __cdecl atexit(void(__cdecl *)(void))
Definition: atonexit.c:56
int debuglevel
Definition: widl.c:110
char * header_name
Definition: widl.c:136
static char * make_token(const char *name)
Definition: widl.c:218
int win64_packing
Definition: widl.c:128
static const struct option long_options[]
Definition: widl.c:185
int parser_parse(parser_ctx_t *ctx)
Definition: widl.h:88
void * xmalloc(int size)
Definition: uimain.c:747
#define DEBUGLEVEL_TRACE
Definition: widl.h:32
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
char * input_name
Definition: widl.c:133
char * proxy_name
Definition: widl.c:141
smooth NULL
Definition: ftsmooth.c:416
static void set_target(const char *target)
Definition: widl.c:278
int strendswith(const char *str, const char *end)
Definition: utils.c:238
#define DEBUGLEVEL_PPLEX
Definition: widl.h:34
target_cpu
Definition: widl.h:78
char * typelib_name
Definition: widl.c:139
int do_typelib
Definition: widl.c:117
void init_types(void)
Definition: parser.tab.c:5310
static char * dup_basename_token(const char *name, const char *ext)
Definition: widl.c:239
time_t now
Definition: widl.c:160
static void write_dlldata_list(struct list *filenames, int define_proxy_delegation)
Definition: widl.c:377
int do_header
Definition: widl.c:116
#define DEBUGLEVEL_PPMSG
Definition: widl.h:33
int yy_flex_debug
Definition: widl.c:111
int wpp_add_include_path(const char *path)
Definition: preproc.c:460
#define LIST_INIT(head)
Definition: queue.h:197
void wpp_set_debug(int lex_debug, int parser_debug, int msg_debug)
Definition: wpp.c:168
int do_proxies
Definition: widl.c:119
static void set_everything(int x)
Definition: widl.c:327
static int no_preprocess
Definition: widl.c:125
int do_idfile
Definition: widl.c:123
char * server_name
Definition: widl.c:145
int ret
int do_dlldata
Definition: widl.c:124
static void rm_tempfile(void)
Definition: widl.c:958
int signal
Definition: xcptfil.c:12
char * input_idl_name
Definition: widl.c:134
char * regscript_name
Definition: widl.c:147
#define DEBUGLEVEL_PPTRACE
Definition: widl.h:35
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
Definition: _list.h:228
FILE * parser_in
Definition: parser.yy.c:357
char * local_stubs_name
Definition: widl.c:137
char * client_token
Definition: widl.c:144
_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
Definition: widl.c:158
int use_abi_namespace
Definition: widl.c:130
#define SIGTERM
Definition: signal.h:39
stub_mode
Definition: widl.h:85
static void add_widl_version_define(void)
Definition: widl.c:247
const char * optarg
Definition: getopt.c:49
void chat(const char *s,...)
Definition: utils.c:131
static const char version_string[]
Definition: widl.c:92
Definition: widl.h:87
_Check_return_ _CRTIMP FILE *__cdecl fdopen(_In_ int _FileHandle, _In_z_ const char *_Format)
int wpp_add_cmdline_define(const char *value)
Definition: wpp.c:153
int pedantic
Definition: widl.c:113
int mkstemps(char *template, int suffix_len)
Definition: mkstemps.c:73
char * client_name
Definition: widl.c:143
#define EOF
Definition: stdio.h:24
Definition: name.c:36
int do_everything
Definition: widl.c:114
_Check_return_ long __cdecl strtol(_In_z_ const char *_Str, _Out_opt_ _Deref_post_z_ char **_EndPtr, _In_ int _Radix)
int do_regscript
Definition: widl.c:122
char * dlldata_name
Definition: widl.c:140
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * dup_basename(const char *name, const char *ext)
Definition: utils.c:143
const char * prefix_server
Definition: widl.c:152
int do_old_typelib
Definition: widl.c:118
FILE * stderr
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int old_names
Definition: widl.c:126
_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)
Definition: widl.c:367
static const char short_options[]
Definition: widl.c:183
#define SIGHUP
Definition: signal.h:22
void exit(int exitcode)
Definition: _exit.c:33
char * xstrdup(const char *s)
Definition: uimain.c:768
char * acf_name
Definition: widl.c:135
static void add_filename_node(struct list *list, const char *name)
Definition: widl.c:360
int winrt_mode
Definition: widl.c:129
int wpp_parse(const char *input, FILE *output)
Definition: wpp.c:184
#define printf
Definition: config.h:203
Definition: widl.h:89
GLuint const GLchar * name
Definition: glext.h:6031

◆ make_token()

static char* make_token ( const char name)
static

Definition at line 218 of file widl.c.

219 {
220  char *token;
221  char *slash;
222  int i;
223 
224  slash = strrchr(name, '/');
225  if(!slash)
226  slash = strrchr(name, '\\');
227 
228  if (slash) name = slash + 1;
229 
230  token = xstrdup(name);
231  for (i=0; token[i]; i++) {
232  if (!isalnum(token[i])) token[i] = '_';
233  else token[i] = tolower(token[i]);
234  }
235  return token;
236 }
_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)
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
Definition: glfuncs.h:248
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
Definition: glfuncs.h:210
Definition: name.c:36
char * xstrdup(const char *s)
Definition: uimain.c:768
int tolower(int c)
Definition: utclib.c:902

Referenced by main().

◆ rm_tempfile()

static void rm_tempfile ( void  )
static

Definition at line 958 of file widl.c.

959 {
960  abort_import();
961  if(temp_name)
962  unlink(temp_name);
963  if (do_header)
965  if (local_stubs_name)
967  if (do_client)
969  if (do_server)
971  if (do_regscript)
973  if (do_idfile)
975  if (do_proxies)
977  if (do_typelib)
979 }
static char * idfile_name
Definition: widl.c:149
int do_client
Definition: widl.c:120
void abort_import(void)
Definition: parser.yy.c:2705
char * temp_name
Definition: widl.c:150
#define unlink
Definition: syshdrs.h:54
int do_server
Definition: widl.c:121
char * header_name
Definition: widl.c:136
char * proxy_name
Definition: widl.c:141
char * typelib_name
Definition: widl.c:139
int do_typelib
Definition: widl.c:117
int do_header
Definition: widl.c:116
int do_proxies
Definition: widl.c:119
int do_idfile
Definition: widl.c:123
char * server_name
Definition: widl.c:145
char * regscript_name
Definition: widl.c:147
char * local_stubs_name
Definition: widl.c:137
char * client_name
Definition: widl.c:143
int do_regscript
Definition: widl.c:122

Referenced by main().

◆ set_everything()

static void set_everything ( int  x)
static

Definition at line 327 of file widl.c.

328 {
329  do_header = x;
330  do_typelib = x;
331  do_old_typelib = x;
332  do_proxies = x;
333  do_client = x;
334  do_server = x;
335  do_regscript = x;
336  do_idfile = x;
337  do_dlldata = x;
338 }
int do_client
Definition: widl.c:120
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int do_server
Definition: widl.c:121
int do_typelib
Definition: widl.c:117
int do_header
Definition: widl.c:116
int do_proxies
Definition: widl.c:119
int do_idfile
Definition: widl.c:123
int do_dlldata
Definition: widl.c:124
int do_regscript
Definition: widl.c:122
int do_old_typelib
Definition: widl.c:118

Referenced by main().

◆ set_target()

static void set_target ( const char target)
static

Definition at line 278 of file widl.c.

279 {
280  static const struct
281  {
282  const char *name;
283  enum target_cpu cpu;
284  } cpu_names[] =
285  {
286  { "i386", CPU_x86 },
287  { "i486", CPU_x86 },
288  { "i586", CPU_x86 },
289  { "i686", CPU_x86 },
290  { "i786", CPU_x86 },
291  { "amd64", CPU_x86_64 },
292  { "x86_64", CPU_x86_64 },
293  { "powerpc", CPU_POWERPC },
294  { "arm", CPU_ARM },
295  { "armv5", CPU_ARM },
296  { "armv6", CPU_ARM },
297  { "armv7", CPU_ARM },
298  { "arm64", CPU_ARM64 },
299  { "aarch64", CPU_ARM64 },
300  };
301 
302  unsigned int i;
303  char *p, *spec = xstrdup( target );
304 
305  /* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */
306 
307  if (!(p = strchr( spec, '-' ))) error( "Invalid target specification '%s'\n", target );
308  *p++ = 0;
309  for (i = 0; i < sizeof(cpu_names)/sizeof(cpu_names[0]); i++)
310  {
311  if (!strcmp( cpu_names[i].name, spec ))
312  {
313  target_cpu = cpu_names[i].cpu;
314  free( spec );
315  return;
316  }
317  }
318  error( "Unrecognized CPU '%s'\n", spec );
319 }
#define error(str)
Definition: mkdosfs.c:1605
Definition: widl.h:80
#define free
Definition: debug_ros.c:5
Definition: widl.h:80
Definition: widl.h:80
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
Definition: glfuncs.h:248
target_cpu
Definition: widl.h:78
char * strchr(const char *String, int ch)
Definition: utclib.c:501
Definition: name.c:36
GLenum target
Definition: glext.h:7315
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLfloat GLfloat p
Definition: glext.h:8902
char * xstrdup(const char *s)
Definition: uimain.c:768
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by main().

◆ start_cplusplus_guard()

void start_cplusplus_guard ( FILE fp)

Definition at line 340 of file widl.c.

341 {
342  fprintf(fp, "#ifdef __cplusplus\n");
343  fprintf(fp, "extern \"C\" {\n");
344  fprintf(fp, "#endif\n\n");
345 }
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)

Referenced by write_dlldata_list(), write_header(), and write_id_data().

◆ write_dlldata()

void write_dlldata ( const statement_list_t stmts)

Definition at line 422 of file widl.c.

423 {
424  struct list filenames = LIST_INIT(filenames);
425  int define_proxy_delegation = 0;
427  FILE *dlldata;
428 
429  if (!do_dlldata || !need_proxy_file(stmts))
430  return;
431 
432  define_proxy_delegation = need_proxy_delegation(stmts);
433 
434  dlldata = fopen(dlldata_name, "r");
435  if (dlldata) {
436  static const char marker[] = "REFERENCE_PROXY_FILE";
437  static const char delegation_define[] = "#define PROXY_DELEGATION";
438  char *line = NULL;
439  size_t len = 0;
440 
441  while (widl_getline(&line, &len, dlldata)) {
442  char *start, *end;
443  start = eat_space(line);
444  if (strncmp(start, marker, sizeof marker - 1) == 0) {
445  start = eat_space(start + sizeof marker - 1);
446  if (*start != '(')
447  continue;
448  end = start = eat_space(start + 1);
449  while (*end && *end != ')')
450  ++end;
451  if (*end != ')')
452  continue;
453  while (isspace((unsigned char) end[-1]))
454  --end;
455  *end = '\0';
456  if (start < end)
457  add_filename_node(&filenames, start);
458  }else if (!define_proxy_delegation && strncmp(start, delegation_define, sizeof(delegation_define)-1)) {
459  define_proxy_delegation = 1;
460  }
461  }
462 
463  if (ferror(dlldata))
464  error("couldn't read from %s: %s\n", dlldata_name, strerror(errno));
465 
466  free(line);
467  fclose(dlldata);
468  }
469 
471  if (strcmp(proxy_token, node->filename) == 0) {
472  /* We're already in the list, no need to regenerate this file. */
473  free_filename_nodes(&filenames);
474  return;
475  }
476 
477  add_filename_node(&filenames, proxy_token);
478  write_dlldata_list(&filenames, define_proxy_delegation);
479  free_filename_nodes(&filenames);
480 }
#define isspace(c)
Definition: acclib.h:69
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
size_t widl_getline(char **linep, size_t *lenp, FILE *fp)
Definition: utils.c:172
#define error(str)
Definition: mkdosfs.c:1605
#define free
Definition: debug_ros.c:5
char * proxy_token
Definition: widl.c:142
GLuint GLuint end
Definition: gl.h:1545
int errno
const char * strerror(int err)
Definition: compat_str.c:23
int need_proxy_delegation(const statement_list_t *stmts)
Definition: proxy.c:814
struct node node
int need_proxy_file(const statement_list_t *stmts)
Definition: proxy.c:809
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
static char * eat_space(char *s)
Definition: widl.c:415
int marker
Definition: jpeglib.h:1027
Definition: parser.c:48
static void write_dlldata_list(struct list *filenames, int define_proxy_delegation)
Definition: widl.c:377
#define LIST_INIT(head)
Definition: queue.h:197
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
int do_dlldata
Definition: widl.c:124
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
_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)
GLuint start
Definition: gl.h:1545
char * dlldata_name
Definition: widl.c:140
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static void free_filename_nodes(struct list *list)
Definition: widl.c:367
const WCHAR * link
Definition: db.cpp:985
static void add_filename_node(struct list *list, const char *name)
Definition: widl.c:360
Definition: dlist.c:348

Referenced by yyparse().

◆ write_dlldata_list()

static void write_dlldata_list ( struct list filenames,
int  define_proxy_delegation 
)
static

Definition at line 377 of file widl.c.

378 {
379  FILE *dlldata;
381 
382  dlldata = fopen(dlldata_name, "w");
383  if (!dlldata)
384  error("couldn't open %s: %s\n", dlldata_name, strerror(errno));
385 
386  fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
387  fprintf(dlldata, "- Do not edit ***/\n\n");
388  if (define_proxy_delegation)
389  fprintf(dlldata, "#define PROXY_DELEGATION\n");
390 
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");
395 
396  fprintf(dlldata, "#include <objbase.h>\n");
397  fprintf(dlldata, "#include <rpcproxy.h>\n\n");
398  start_cplusplus_guard(dlldata);
399 
401  fprintf(dlldata, "EXTERN_PROXY_FILE(%s)\n", node->filename);
402 
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");
409 
410  fprintf(dlldata, "DLLDATA_ROUTINES(aProxyFileList, GET_DLL_CLSID)\n\n");
411  end_cplusplus_guard(dlldata);
412  fclose(dlldata);
413 }
#define error(str)
Definition: mkdosfs.c:1605
#define PACKAGE_VERSION
Definition: config.h:835
int errno
const char * strerror(int err)
Definition: compat_str.c:23
void start_cplusplus_guard(FILE *fp)
Definition: widl.c:340
struct node node
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
void end_cplusplus_guard(FILE *fp)
Definition: widl.c:347
_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)
char * dlldata_name
Definition: widl.c:140
const WCHAR * link
Definition: db.cpp:985
Definition: dlist.c:348

Referenced by main(), and write_dlldata().

◆ write_id_data()

void write_id_data ( const statement_list_t stmts)

Definition at line 529 of file widl.c.

530 {
531  if (!do_idfile) return;
532 
533  idfile = fopen(idfile_name, "w");
534  if (! idfile) {
535  error("Could not open %s for output\n", idfile_name);
536  return;
537  }
538 
539  fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
540  fprintf(idfile, "from %s - Do not edit ***/\n\n", input_idl_name);
541 
542  fprintf(idfile, "#ifdef __REACTOS__\n");
543  fprintf(idfile, "#define WIN32_NO_STATUS\n");
544  fprintf(idfile, "#define WIN32_LEAN_AND_MEAN\n");
545  fprintf(idfile, "#endif\n\n");
546 
547  fprintf(idfile, "#include <rpc.h>\n");
548  fprintf(idfile, "#include <rpcndr.h>\n\n");
549 
550  fprintf(idfile, "#ifdef _MIDL_USE_GUIDDEF_\n\n");
551 
552  fprintf(idfile, "#ifndef INITGUID\n");
553  fprintf(idfile, "#define INITGUID\n");
554  fprintf(idfile, "#include <guiddef.h>\n");
555  fprintf(idfile, "#undef INITGUID\n");
556  fprintf(idfile, "#else\n");
557  fprintf(idfile, "#include <guiddef.h>\n");
558  fprintf(idfile, "#endif\n\n");
559 
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");
562 
563  fprintf(idfile, "#elif defined(__cplusplus)\n\n");
564 
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");
567 
568  fprintf(idfile, "#else\n\n");
569 
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");
572 
573  fprintf(idfile, "#endif\n\n");
575 
576  write_id_data_stmts(stmts);
577 
578  fprintf(idfile, "\n");
580  fprintf(idfile, "#undef MIDL_DEFINE_GUID\n" );
581 
582  fclose(idfile);
583 }
static char * idfile_name
Definition: widl.c:149
#define error(str)
Definition: mkdosfs.c:1605
#define PACKAGE_VERSION
Definition: config.h:835
void start_cplusplus_guard(FILE *fp)
Definition: widl.c:340
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
static FILE * idfile
Definition: widl.c:156
void end_cplusplus_guard(FILE *fp)
Definition: widl.c:347
int do_idfile
Definition: widl.c:123
char * input_idl_name
Definition: widl.c:134
_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)
static void write_id_data_stmts(const statement_list_t *stmts)
Definition: widl.c:492

Referenced by yyparse().

◆ write_id_data_stmts()

static void write_id_data_stmts ( const statement_list_t stmts)
static

Definition at line 492 of file widl.c.

493 {
494  const statement_t *stmt;
495  if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
496  {
497  if (stmt->type == STMT_TYPE)
498  {
499  const type_t *type = stmt->u.type;
501  {
502  const UUID *uuid;
503  if (!is_object(type) && !is_attr(type->attrs, ATTR_DISPINTERFACE))
504  continue;
505  uuid = get_attrp(type->attrs, ATTR_UUID);
506  write_id_guid(idfile, "IID", is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID",
507  type->name, uuid);
508  if (type->details.iface->async_iface)
509  {
510  uuid = get_attrp(type->details.iface->async_iface->attrs, ATTR_UUID);
511  write_id_guid(idfile, "IID", "IID", type->details.iface->async_iface->name, uuid);
512  }
513  }
514  else if (type_get_type(type) == TYPE_COCLASS)
515  {
516  const UUID *uuid = get_attrp(type->attrs, ATTR_UUID);
517  write_id_guid(idfile, "CLSID", "CLSID", type->name, uuid);
518  }
519  }
520  else if (stmt->type == STMT_LIBRARY)
521  {
522  const UUID *uuid = get_attrp(stmt->u.lib->attrs, ATTR_UUID);
523  write_id_guid(idfile, "IID", "LIBID", stmt->u.lib->name, uuid);
524  write_id_data_stmts(stmt->u.lib->stmts);
525  }
526  }
527 }
typelib_t * lib
Definition: widltypes.h:539
void * get_attrp(const attr_list_t *list, enum attr_type t)
Definition: header.c:107
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
char * name
Definition: widltypes.h:514
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
statement_type_t type
Definition: parser.h:124
static void write_id_guid(FILE *f, const char *type, const char *guid_prefix, const char *name, const UUID *uuid)
Definition: widl.c:482
static enum type_type type_get_type(const type_t *type)
Definition: typetree.h:68
static FILE * idfile
Definition: widl.c:156
uint32_t entry
Definition: isohybrid.c:63
const attr_list_t * attrs
Definition: widltypes.h:515
statement_list_t * stmts
Definition: widltypes.h:517
static void write_id_data_stmts(const statement_list_t *stmts)
Definition: widl.c:492
int is_object(const type_t *iface)
Definition: header.c:928
Definition: msctf.idl:510
int is_attr(const attr_list_t *list, enum attr_type t)
Definition: header.c:99
union _statement_t::@4026 u

Referenced by write_id_data().

◆ write_id_guid()

static void write_id_guid ( FILE f,
const char type,
const char guid_prefix,
const char name,
const UUID uuid 
)
static

Definition at line 482 of file widl.c.

483 {
484  if (!uuid) return;
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",
487  type, guid_prefix, name, uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0],
488  uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5],
489  uuid->Data4[6], uuid->Data4[7]);
490 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
GLfloat f
Definition: glext.h:7540
Definition: name.c:36
Definition: msctf.idl:510

Referenced by write_id_data_stmts().

Variable Documentation

◆ acf_name

char* acf_name

Definition at line 135 of file widl.c.

Referenced by main(), switch_to_acf(), and while().

◆ client_name

char* client_name

Definition at line 143 of file widl.c.

Referenced by init_client(), main(), and rm_tempfile().

◆ client_token

char* client_token

Definition at line 144 of file widl.c.

Referenced by main(), and write_client_routines().

◆ debuglevel

int debuglevel = DEBUGLEVEL_NONE

Definition at line 110 of file widl.c.

Referenced by chat(), dump_var_desc(), and main().

◆ dlldata_name

char* dlldata_name

Definition at line 140 of file widl.c.

Referenced by main(), write_dlldata(), and write_dlldata_list().

◆ do_client

int do_client = 0

Definition at line 120 of file widl.c.

Referenced by main(), rm_tempfile(), set_everything(), and write_client().

◆ do_dlldata

int do_dlldata = 0

Definition at line 124 of file widl.c.

Referenced by main(), set_everything(), and write_dlldata().

◆ do_everything

int do_everything = 1

Definition at line 114 of file widl.c.

Referenced by main(), write_client(), write_proxies(), write_regscript(), and write_server().

◆ do_header

int do_header = 0

Definition at line 116 of file widl.c.

Referenced by main(), rm_tempfile(), set_everything(), and write_header().

◆ do_idfile

int do_idfile = 0

Definition at line 123 of file widl.c.

Referenced by main(), rm_tempfile(), set_everything(), and write_id_data().

◆ do_old_typelib

int do_old_typelib = 0

Definition at line 118 of file widl.c.

Referenced by main(), set_everything(), and write_typelib_regscript().

◆ do_proxies

int do_proxies = 0

Definition at line 119 of file widl.c.

Referenced by main(), rm_tempfile(), set_everything(), and write_proxies().

◆ do_regscript

int do_regscript = 0

Definition at line 122 of file widl.c.

Referenced by main(), rm_tempfile(), set_everything(), and write_regscript().

◆ do_server

int do_server = 0

Definition at line 121 of file widl.c.

Referenced by main(), rm_tempfile(), set_everything(), and write_server().

◆ do_typelib

int do_typelib = 0

◆ header_name

◆ header_token

char* header_token

Definition at line 138 of file widl.c.

Referenced by main(), and write_header().

◆ idfile

FILE* idfile
static

Definition at line 156 of file widl.c.

Referenced by write_id_data(), and write_id_data_stmts().

◆ idfile_name

char* idfile_name
static

Definition at line 149 of file widl.c.

Referenced by main(), rm_tempfile(), and write_id_data().

◆ input_idl_name

char* input_idl_name

Definition at line 134 of file widl.c.

Referenced by gen_name(), main(), and write_id_data().

◆ input_name

char* input_name

Definition at line 133 of file widl.c.

Referenced by main().

◆ line_number

int line_number = 1

Definition at line 154 of file widl.c.

◆ local_stubs_name

char* local_stubs_name

Definition at line 137 of file widl.c.

Referenced by main(), rm_tempfile(), and write_local_stubs().

◆ long_options

const struct option long_options[]
static
Initial value:
= {
{ "acf", 1, NULL, ACF_OPTION },
{ "app_config", 0, NULL, APP_CONFIG_OPTION },
{ "dlldata", 1, NULL, DLLDATA_OPTION },
{ "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION },
{ "help", 0, NULL, PRINT_HELP },
{ "local-stubs", 1, NULL, LOCAL_STUBS_OPTION },
{ "ns_prefix", 0, NULL, RT_NS_PREFIX },
{ "oldnames", 0, NULL, OLDNAMES_OPTION },
{ "oldtlb", 0, NULL, OLD_TYPELIB_OPTION },
{ "output", 0, NULL, 'o' },
{ "prefix-all", 1, NULL, PREFIX_ALL_OPTION },
{ "prefix-client", 1, NULL, PREFIX_CLIENT_OPTION },
{ "prefix-server", 1, NULL, PREFIX_SERVER_OPTION },
{ "robust", 0, NULL, ROBUST_OPTION },
{ "target", 0, NULL, 'b' },
{ "winrt", 0, NULL, RT_OPTION },
{ "win32", 0, NULL, WIN32_OPTION },
{ "win64", 0, NULL, WIN64_OPTION },
{ "win32-align", 1, NULL, WIN32_ALIGN_OPTION },
{ "win64-align", 1, NULL, WIN64_ALIGN_OPTION },
{ NULL, 0, NULL, 0 }
}
smooth NULL
Definition: ftsmooth.c:416

Definition at line 185 of file widl.c.

Referenced by _getopt_long_only_r(), _getopt_long_r(), getopt_long(), getopt_long_only(), and main().

◆ no_preprocess

int no_preprocess = 0
static

Definition at line 125 of file widl.c.

Referenced by main().

◆ now

time_t now

Definition at line 160 of file widl.c.

Referenced by main().

◆ old_names

int old_names = 0

◆ parser_debug

int parser_debug

Definition at line 111 of file widl.c.

Referenced by main(), and wpp_set_debug().

◆ pedantic

int pedantic = 0

Definition at line 113 of file widl.c.

Referenced by main(), and tt_loader_init().

◆ pointer_size

◆ prefix_client

◆ prefix_server

◆ preprocess_only

int preprocess_only = 0
static

Definition at line 115 of file widl.c.

Referenced by main().

◆ proxy_name

char* proxy_name

Definition at line 141 of file widl.c.

Referenced by init_proxy(), main(), and rm_tempfile().

◆ proxy_token

char* proxy_token

Definition at line 142 of file widl.c.

Referenced by main(), write_dlldata(), and write_proxy_routines().

◆ regscript_name

char* regscript_name

Definition at line 147 of file widl.c.

Referenced by main(), rm_tempfile(), and write_regscript().

◆ regscript_token

char* regscript_token

Definition at line 148 of file widl.c.

Referenced by main(), and write_regscript().

◆ server_name

◆ server_token

char* server_token

Definition at line 146 of file widl.c.

Referenced by main(), and write_server_routines().

◆ short_options

const char short_options[]
static
Initial value:
=
"b:cC:d:D:EhH:I:m:No:O:pP:rsS:tT:uU:VW"

Definition at line 183 of file widl.c.

Referenced by main().

◆ stub_mode

Definition at line 131 of file widl.c.

Referenced by get_stub_mode().

◆ temp_name

char* temp_name

Definition at line 150 of file widl.c.

Referenced by main(), rm_tempfile(), and StgOpenStorage().

◆ typelib_name

char* typelib_name

◆ usage

const char usage[]
static

Definition at line 46 of file widl.c.

◆ use_abi_namespace

int use_abi_namespace = 0

◆ version_string

const char version_string[]
static
Initial value:
= "Wine IDL Compiler version " PACKAGE_VERSION "\n"
"Copyright 2002 Ove Kaaven\n"
#define PACKAGE_VERSION
Definition: config.h:835

Definition at line 92 of file widl.c.

Referenced by main().

◆ win32_packing

int win32_packing = 8

Definition at line 127 of file widl.c.

Referenced by clamp_align(), and main().

◆ win64_packing

int win64_packing = 8

Definition at line 128 of file widl.c.

Referenced by clamp_align(), and main().

◆ winrt_mode

int winrt_mode = 0

◆ yy_flex_debug

int yy_flex_debug

Definition at line 111 of file widl.c.

Referenced by main(), yyget_debug(), and yyset_debug().