widl: Check for [string] attribute being applied when the elements are ranged.
[wine] / tools / widl / widl.c
1 /*
2  * IDL Compiler
3  *
4  * Copyright 2002 Ove Kaaven
5  * based on WRC code by Bertho Stultiens
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "config.h"
23 #include "wine/port.h"
24
25 #include <errno.h>
26 #include <limits.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29 #ifdef HAVE_UNISTD_H
30 # include <unistd.h>
31 #endif
32 #include <string.h>
33 #include <assert.h>
34 #include <ctype.h>
35 #include <signal.h>
36 #ifdef HAVE_GETOPT_H
37 # include <getopt.h>
38 #endif
39
40 #include "widl.h"
41 #include "utils.h"
42 #include "parser.h"
43 #include "wine/wpp.h"
44 #include "header.h"
45
46 /* future options to reserve characters for: */
47 /* A = ACF input filename */
48 /* J = do not search standard include path */
49 /* O = generate interpreted stubs */
50 /* w = select win16/win32 output (?) */
51
52 static const char usage[] =
53 "Usage: widl [options...] infile.idl\n"
54 "   or: widl [options...] --dlldata-only name1 [name2...]\n"
55 "   -b arch            Set the target architecture\n"
56 "   -c                 Generate client stub\n"
57 "   -C file            Name of client stub file (default is infile_c.c)\n"
58 "   -d n               Set debug level to 'n'\n"
59 "   -D id[=val]        Define preprocessor identifier id=val\n"
60 "   --dlldata=file     Name of the dlldata file (default is dlldata.c)\n"
61 "   -E                 Preprocess only\n"
62 "   -h                 Generate headers\n"
63 "   -H file            Name of header file (default is infile.h)\n"
64 "   -I path            Set include search dir to path (multiple -I allowed)\n"
65 "   --local-stubs=file Write empty stubs for call_as/local methods to file\n"
66 "   -m32, -m64         Set the kind of typelib to build (Win32 or Win64)\n"
67 "   -N                 Do not preprocess input\n"
68 "   --oldnames         Use old naming conventions\n"
69 "   -p                 Generate proxy\n"
70 "   -P file            Name of proxy file (default is infile_p.c)\n"
71 "   --prefix-all=p     Prefix names of client stubs / server functions with 'p'\n"
72 "   --prefix-client=p  Prefix names of client stubs with 'p'\n"
73 "   --prefix-server=p  Prefix names of server functions with 'p'\n"
74 "   -s                 Generate server stub\n"
75 "   -S file            Name of server stub file (default is infile_s.c)\n"
76 "   -t                 Generate typelib\n"
77 "   -T file            Name of typelib file (default is infile.tlb)\n"
78 "   -u                 Generate interface identifiers file\n"
79 "   -U file            Name of interface identifiers file (default is infile_i.c)\n"
80 "   -V                 Print version and exit\n"
81 "   -W                 Enable pedantic warnings\n"
82 "   --win32            Only generate 32-bit code\n"
83 "   --win64            Only generate 64-bit code\n"
84 "   --win32-align n    Set win32 structure alignment to 'n'\n"
85 "   --win64-align n    Set win64 structure alignment to 'n'\n"
86 "Debug level 'n' is a bitmask with following meaning:\n"
87 "    * 0x01 Tell which resource is parsed (verbose mode)\n"
88 "    * 0x02 Dump internal structures\n"
89 "    * 0x04 Create a parser trace (yydebug=1)\n"
90 "    * 0x08 Preprocessor messages\n"
91 "    * 0x10 Preprocessor lex messages\n"
92 "    * 0x20 Preprocessor yacc trace\n"
93 ;
94
95 static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSION "\n"
96                         "Copyright 2002 Ove Kaaven\n";
97
98 int debuglevel = DEBUGLEVEL_NONE;
99 int parser_debug, yy_flex_debug;
100
101 int pedantic = 0;
102 int do_everything = 1;
103 int preprocess_only = 0;
104 int do_header = 0;
105 int do_typelib = 0;
106 int do_proxies = 0;
107 int do_client = 0;
108 int do_server = 0;
109 int do_idfile = 0;
110 int do_dlldata = 0;
111 int no_preprocess = 0;
112 int old_names = 0;
113 int do_win32 = 1;
114 int do_win64 = 1;
115 int win32_packing = 8;
116 int win64_packing = 8;
117
118 char *input_name;
119 char *header_name;
120 char *local_stubs_name;
121 char *header_token;
122 char *typelib_name;
123 char *dlldata_name;
124 char *proxy_name;
125 char *proxy_token;
126 char *client_name;
127 char *client_token;
128 char *server_name;
129 char *server_token;
130 char *idfile_name;
131 char *idfile_token;
132 char *temp_name;
133 const char *prefix_client = "";
134 const char *prefix_server = "";
135
136 int line_number = 1;
137
138 FILE *header;
139 FILE *idfile;
140
141 size_t pointer_size = 0;
142 syskind_t typelib_kind = sizeof(void*) == 8 ? SYS_WIN64 : SYS_WIN32;
143
144 time_t now;
145
146 enum {
147     OLDNAMES_OPTION = CHAR_MAX + 1,
148     DLLDATA_OPTION,
149     DLLDATA_ONLY_OPTION,
150     LOCAL_STUBS_OPTION,
151     PREFIX_ALL_OPTION,
152     PREFIX_CLIENT_OPTION,
153     PREFIX_SERVER_OPTION,
154     WIN32_OPTION,
155     WIN64_OPTION,
156     WIN32_ALIGN_OPTION,
157     WIN64_ALIGN_OPTION
158 };
159
160 static const char short_options[] =
161     "b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW";
162 static const struct option long_options[] = {
163     { "dlldata", 1, 0, DLLDATA_OPTION },
164     { "dlldata-only", 0, 0, DLLDATA_ONLY_OPTION },
165     { "local-stubs", 1, 0, LOCAL_STUBS_OPTION },
166     { "oldnames", 0, 0, OLDNAMES_OPTION },
167     { "prefix-all", 1, 0, PREFIX_ALL_OPTION },
168     { "prefix-client", 1, 0, PREFIX_CLIENT_OPTION },
169     { "prefix-server", 1, 0, PREFIX_SERVER_OPTION },
170     { "win32", 0, 0, WIN32_OPTION },
171     { "win64", 0, 0, WIN64_OPTION },
172     { "win32-align", 1, 0, WIN32_ALIGN_OPTION },
173     { "win64-align", 1, 0, WIN64_ALIGN_OPTION },
174     { 0, 0, 0, 0 }
175 };
176
177 static void rm_tempfile(void);
178
179 static char *make_token(const char *name)
180 {
181   char *token;
182   char *slash;
183   int i;
184
185   slash = strrchr(name, '/');
186   if(!slash)
187     slash = strrchr(name, '\\');
188
189   if (slash) name = slash + 1;
190
191   token = xstrdup(name);
192   for (i=0; token[i]; i++) {
193     if (!isalnum(token[i])) token[i] = '_';
194     else token[i] = toupper(token[i]);
195   }
196   return token;
197 }
198
199 /* duplicate a basename into a valid C token */
200 static char *dup_basename_token(const char *name, const char *ext)
201 {
202     char *p, *ret = dup_basename( name, ext );
203     /* map invalid characters to '_' */
204     for (p = ret; *p; p++) if (!isalnum(*p)) *p = '_';
205     return ret;
206 }
207
208 static void add_widl_version_define(void)
209 {
210     unsigned int version;
211     const char *p = PACKAGE_VERSION;
212
213     /* major */
214     version = atoi(p) * 0x10000;
215     p = strchr(p, '.');
216
217     /* minor */
218     if (p)
219     {
220         version += atoi(p + 1) * 0x100;
221         p = strchr(p + 1, '.');
222     }
223
224     /* build */
225     if (p)
226         version += atoi(p + 1);
227
228     if (version != 0)
229     {
230         char version_str[11];
231         snprintf(version_str, sizeof(version_str), "0x%x", version);
232         wpp_add_define("__WIDL__", version_str);
233     }
234     else
235         wpp_add_define("__WIDL__", NULL);
236 }
237
238 /* set the target platform */
239 static void set_target( const char *target )
240 {
241     static const struct
242     {
243         const char *name;
244         syskind_t   kind;
245     } cpu_names[] =
246     {
247         { "i386",    SYS_WIN32 },
248         { "i486",    SYS_WIN32 },
249         { "i586",    SYS_WIN32 },
250         { "i686",    SYS_WIN32 },
251         { "i786",    SYS_WIN32 },
252         { "x86_64",  SYS_WIN64 },
253         { "sparc",   SYS_WIN32 },
254         { "alpha",   SYS_WIN32 },
255         { "powerpc", SYS_WIN32 },
256         { "arm",     SYS_WIN32 }
257     };
258
259     unsigned int i;
260     char *p, *spec = xstrdup( target );
261
262     /* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */
263
264     if (!(p = strchr( spec, '-' ))) error( "Invalid target specification '%s'\n", target );
265     *p++ = 0;
266     for (i = 0; i < sizeof(cpu_names)/sizeof(cpu_names[0]); i++)
267     {
268         if (!strcmp( cpu_names[i].name, spec ))
269         {
270             typelib_kind = cpu_names[i].kind;
271             free( spec );
272             return;
273         }
274     }
275     error( "Unrecognized CPU '%s'\n", spec );
276 }
277
278 /* clean things up when aborting on a signal */
279 static void exit_on_signal( int sig )
280 {
281     exit(1);  /* this will call the atexit functions */
282 }
283
284 static void set_everything(int x)
285 {
286   do_header = x;
287   do_typelib = x;
288   do_proxies = x;
289   do_client = x;
290   do_server = x;
291   do_idfile = x;
292   do_dlldata = x;
293 }
294
295 void start_cplusplus_guard(FILE *fp)
296 {
297   fprintf(fp, "#ifdef __cplusplus\n");
298   fprintf(fp, "extern \"C\" {\n");
299   fprintf(fp, "#endif\n\n");
300 }
301
302 void end_cplusplus_guard(FILE *fp)
303 {
304   fprintf(fp, "#ifdef __cplusplus\n");
305   fprintf(fp, "}\n");
306   fprintf(fp, "#endif\n\n");
307 }
308
309 typedef struct
310 {
311   char *filename;
312   struct list link;
313 } filename_node_t;
314
315 static void add_filename_node(struct list *list, const char *name)
316 {
317   filename_node_t *node = xmalloc(sizeof *node);
318   node->filename = dup_basename( name, ".idl" );
319   list_add_tail(list, &node->link);
320 }
321
322 static void free_filename_nodes(struct list *list)
323 {
324   filename_node_t *node, *next;
325   LIST_FOR_EACH_ENTRY_SAFE(node, next, list, filename_node_t, link) {
326     list_remove(&node->link);
327     free(node->filename);
328     free(node);
329   }
330 }
331
332 static void write_dlldata_list(struct list *filenames)
333 {
334   FILE *dlldata;
335   filename_node_t *node;
336
337   dlldata = fopen(dlldata_name, "w");
338   if (!dlldata)
339     error("couldn't open %s: %s\n", dlldata_name, strerror(errno));
340
341   fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
342   fprintf(dlldata, "- Do not edit ***/\n\n");
343   fprintf(dlldata, "#include <objbase.h>\n");
344   fprintf(dlldata, "#include <rpcproxy.h>\n\n");
345   start_cplusplus_guard(dlldata);
346
347   LIST_FOR_EACH_ENTRY(node, filenames, filename_node_t, link)
348     fprintf(dlldata, "EXTERN_PROXY_FILE(%s)\n", node->filename);
349
350   fprintf(dlldata, "\nPROXYFILE_LIST_START\n");
351   fprintf(dlldata, "/* Start of list */\n");
352   LIST_FOR_EACH_ENTRY(node, filenames, filename_node_t, link)
353     fprintf(dlldata, "  REFERENCE_PROXY_FILE(%s),\n", node->filename);
354   fprintf(dlldata, "/* End of list */\n");
355   fprintf(dlldata, "PROXYFILE_LIST_END\n\n");
356
357   fprintf(dlldata, "DLLDATA_ROUTINES(aProxyFileList, GET_DLL_CLSID)\n\n");
358   end_cplusplus_guard(dlldata);
359   fclose(dlldata);
360 }
361
362 static char *eat_space(char *s)
363 {
364   while (isspace((unsigned char) *s))
365     ++s;
366   return s;
367 }
368
369 void write_dlldata(const statement_list_t *stmts)
370 {
371   struct list filenames = LIST_INIT(filenames);
372   filename_node_t *node;
373   FILE *dlldata;
374
375   if (!do_dlldata || !need_proxy_file(stmts))
376     return;
377
378   dlldata = fopen(dlldata_name, "r");
379   if (dlldata) {
380     static char marker[] = "REFERENCE_PROXY_FILE";
381     char *line = NULL;
382     size_t len = 0;
383
384     while (widl_getline(&line, &len, dlldata)) {
385       char *start, *end;
386       start = eat_space(line);
387       if (strncmp(start, marker, sizeof marker - 1) == 0) {
388         start = eat_space(start + sizeof marker - 1);
389         if (*start != '(')
390           continue;
391         end = start = eat_space(start + 1);
392         while (*end && *end != ')')
393           ++end;
394         if (*end != ')')
395           continue;
396         while (isspace((unsigned char) end[-1]))
397           --end;
398         *end = '\0';
399         if (start < end)
400           add_filename_node(&filenames, start);
401       }
402     }
403
404     if (ferror(dlldata))
405       error("couldn't read from %s: %s\n", dlldata_name, strerror(errno));
406
407     free(line);
408     fclose(dlldata);
409   }
410
411   LIST_FOR_EACH_ENTRY(node, &filenames, filename_node_t, link)
412     if (strcmp(proxy_token, node->filename) == 0) {
413       /* We're already in the list, no need to regenerate this file.  */
414       free_filename_nodes(&filenames);
415       return;
416     }
417
418   add_filename_node(&filenames, proxy_token);
419   write_dlldata_list(&filenames);
420   free_filename_nodes(&filenames);
421 }
422
423 static void write_id_data_stmts(const statement_list_t *stmts)
424 {
425   const statement_t *stmt;
426   if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
427   {
428     if (stmt->type == STMT_TYPE)
429     {
430       const type_t *type = stmt->u.type;
431       if (type_get_type(type) == TYPE_INTERFACE)
432       {
433         const UUID *uuid;
434         if (!is_object(type->attrs) && !is_attr(type->attrs, ATTR_DISPINTERFACE))
435           continue;
436         uuid = get_attrp(type->attrs, ATTR_UUID);
437         write_guid(idfile, is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID",
438                    type->name, uuid);
439       }
440       else if (type_get_type(type) == TYPE_COCLASS)
441       {
442         const UUID *uuid = get_attrp(type->attrs, ATTR_UUID);
443         write_guid(idfile, "CLSID", type->name, uuid);
444       }
445     }
446     else if (stmt->type == STMT_LIBRARY)
447     {
448       const UUID *uuid = get_attrp(stmt->u.lib->attrs, ATTR_UUID);
449       write_guid(idfile, "LIBID", stmt->u.lib->name, uuid);
450       write_id_data_stmts(stmt->u.lib->stmts);
451     }
452   }
453 }
454
455 void write_id_data(const statement_list_t *stmts)
456 {
457   if (!do_idfile) return;
458
459   idfile_token = make_token(idfile_name);
460
461   idfile = fopen(idfile_name, "w");
462   if (! idfile) {
463     error("Could not open %s for output\n", idfile_name);
464     return;
465   }
466
467   fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
468   fprintf(idfile, "from %s - Do not edit ***/\n\n", input_name);
469   fprintf(idfile, "#include <rpc.h>\n");
470   fprintf(idfile, "#include <rpcndr.h>\n\n");
471   fprintf(idfile, "#include <initguid.h>\n\n");
472   start_cplusplus_guard(idfile);
473
474   write_id_data_stmts(stmts);
475
476   fprintf(idfile, "\n");
477   end_cplusplus_guard(idfile);
478
479   fclose(idfile);
480 }
481
482 int main(int argc,char *argv[])
483 {
484   extern char* optarg;
485   extern int   optind;
486   int optc;
487   int ret = 0;
488   int opti = 0;
489
490   signal( SIGTERM, exit_on_signal );
491   signal( SIGINT, exit_on_signal );
492 #ifdef SIGHUP
493   signal( SIGHUP, exit_on_signal );
494 #endif
495
496   now = time(NULL);
497
498   while((optc = getopt_long(argc, argv, short_options, long_options, &opti)) != EOF) {
499     switch(optc) {
500     case DLLDATA_OPTION:
501       dlldata_name = xstrdup(optarg);
502       break;
503     case DLLDATA_ONLY_OPTION:
504       do_everything = 0;
505       do_dlldata = 1;
506       break;
507     case LOCAL_STUBS_OPTION:
508       do_everything = 0;
509       local_stubs_name = xstrdup(optarg);
510       break;
511     case OLDNAMES_OPTION:
512       old_names = 1;
513       break;
514     case PREFIX_ALL_OPTION:
515       prefix_client = xstrdup(optarg);
516       prefix_server = xstrdup(optarg);
517       break;
518     case PREFIX_CLIENT_OPTION:
519       prefix_client = xstrdup(optarg);
520       break;
521     case PREFIX_SERVER_OPTION:
522       prefix_server = xstrdup(optarg);
523       break;
524     case WIN32_OPTION:
525       do_win32 = 1;
526       do_win64 = 0;
527       break;
528     case WIN64_OPTION:
529       do_win32 = 0;
530       do_win64 = 1;
531       break;
532     case WIN32_ALIGN_OPTION:
533       win32_packing = strtol(optarg, NULL, 0);
534       if(win32_packing != 2 && win32_packing != 4 && win32_packing != 8)
535           error("Packing must be one of 2, 4 or 8\n");
536       break;
537     case WIN64_ALIGN_OPTION:
538       win64_packing = strtol(optarg, NULL, 0);
539       if(win64_packing != 2 && win64_packing != 4 && win64_packing != 8)
540           error("Packing must be one of 2, 4 or 8\n");
541       break;
542     case 'b':
543       set_target( optarg );
544       break;
545     case 'c':
546       do_everything = 0;
547       do_client = 1;
548       break;
549     case 'C':
550       client_name = xstrdup(optarg);
551       break;
552     case 'd':
553       debuglevel = strtol(optarg, NULL, 0);
554       break;
555     case 'D':
556       wpp_add_cmdline_define(optarg);
557       break;
558     case 'E':
559       do_everything = 0;
560       preprocess_only = 1;
561       break;
562     case 'h':
563       do_everything = 0;
564       do_header = 1;
565       break;
566     case 'H':
567       header_name = xstrdup(optarg);
568       break;
569     case 'I':
570       wpp_add_include_path(optarg);
571       break;
572     case 'm':
573       if (!strcmp( optarg, "32" )) typelib_kind = SYS_WIN32;
574       else if (!strcmp( optarg, "64" )) typelib_kind = SYS_WIN64;
575       else error( "Invalid -m argument '%s'\n", optarg );
576       break;
577     case 'N':
578       no_preprocess = 1;
579       break;
580     case 'p':
581       do_everything = 0;
582       do_proxies = 1;
583       break;
584     case 'P':
585       proxy_name = xstrdup(optarg);
586       break;
587     case 's':
588       do_everything = 0;
589       do_server = 1;
590       break;
591     case 'S':
592       server_name = xstrdup(optarg);
593       break;
594     case 't':
595       do_everything = 0;
596       do_typelib = 1;
597       break;
598     case 'T':
599       typelib_name = xstrdup(optarg);
600       break;
601     case 'u':
602       do_everything = 0;
603       do_idfile = 1;
604       break;
605     case 'U':
606       idfile_name = xstrdup(optarg);
607       break;
608     case 'V':
609       printf("%s", version_string);
610       return 0;
611     case 'W':
612       pedantic = 1;
613       break;
614     default:
615       fprintf(stderr, "%s", usage);
616       return 1;
617     }
618   }
619
620   if(do_everything) {
621     set_everything(TRUE);
622   }
623
624   if (!dlldata_name && do_dlldata)
625     dlldata_name = xstrdup("dlldata.c");
626
627   if(optind < argc) {
628     if (do_dlldata && !do_everything) {
629       struct list filenames = LIST_INIT(filenames);
630       for ( ; optind < argc; ++optind)
631         add_filename_node(&filenames, argv[optind]);
632
633       write_dlldata_list(&filenames);
634       free_filename_nodes(&filenames);
635       return 0;
636     }
637     else if (optind != argc - 1) {
638       fprintf(stderr, "%s", usage);
639       return 1;
640     }
641     else
642       input_name = xstrdup(argv[optind]);
643   }
644   else {
645     fprintf(stderr, "%s", usage);
646     return 1;
647   }
648
649   if(debuglevel)
650   {
651     setbuf(stdout,0);
652     setbuf(stderr,0);
653   }
654
655   parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
656   yy_flex_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
657
658   wpp_set_debug( (debuglevel & DEBUGLEVEL_PPLEX) != 0,
659                  (debuglevel & DEBUGLEVEL_PPTRACE) != 0,
660                  (debuglevel & DEBUGLEVEL_PPMSG) != 0 );
661
662   if (!header_name) {
663     header_name = dup_basename(input_name, ".idl");
664     strcat(header_name, ".h");
665   }
666
667   if (!typelib_name && do_typelib) {
668     typelib_name = dup_basename(input_name, ".idl");
669     strcat(typelib_name, ".tlb");
670   }
671
672   if (!proxy_name && do_proxies) {
673     proxy_name = dup_basename(input_name, ".idl");
674     strcat(proxy_name, "_p.c");
675   }
676
677   if (!client_name && do_client) {
678     client_name = dup_basename(input_name, ".idl");
679     strcat(client_name, "_c.c");
680   }
681
682   if (!server_name && do_server) {
683     server_name = dup_basename(input_name, ".idl");
684     strcat(server_name, "_s.c");
685   }
686
687   if (!idfile_name && do_idfile) {
688     idfile_name = dup_basename(input_name, ".idl");
689     strcat(idfile_name, "_i.c");
690   }
691
692   if (do_proxies) proxy_token = dup_basename_token(proxy_name,"_p.c");
693   if (do_client) client_token = dup_basename_token(client_name,"_c.c");
694   if (do_server) server_token = dup_basename_token(server_name,"_s.c");
695
696   add_widl_version_define();
697
698   atexit(rm_tempfile);
699   if (!no_preprocess)
700   {
701     chat("Starting preprocess\n");
702
703     if (!preprocess_only)
704     {
705         ret = wpp_parse_temp( input_name, header_name, &temp_name );
706     }
707     else
708     {
709         ret = wpp_parse( input_name, stdout );
710     }
711
712     if(ret) exit(1);
713     if(preprocess_only) exit(0);
714     if(!(parser_in = fopen(temp_name, "r"))) {
715       fprintf(stderr, "Could not open %s for input\n", temp_name);
716       return 1;
717     }
718   }
719   else {
720     if(!(parser_in = fopen(input_name, "r"))) {
721       fprintf(stderr, "Could not open %s for input\n", input_name);
722       return 1;
723     }
724   }
725
726   header_token = make_token(header_name);
727
728   init_types();
729   ret = parser_parse();
730
731   fclose(parser_in);
732
733   if(ret) {
734     exit(1);
735   }
736
737   /* Everything has been done successfully, don't delete any files.  */
738   set_everything(FALSE);
739   local_stubs_name = NULL;
740
741   return 0;
742 }
743
744 static void rm_tempfile(void)
745 {
746   abort_import();
747   if(temp_name)
748     unlink(temp_name);
749   if (do_header)
750     unlink(header_name);
751   if (local_stubs_name)
752     unlink(local_stubs_name);
753   if (do_client)
754     unlink(client_name);
755   if (do_server)
756     unlink(server_name);
757   if (do_idfile)
758     unlink(idfile_name);
759   if (do_proxies)
760     unlink(proxy_name);
761   if (do_typelib)
762     unlink(typelib_name);
763 }