| 1 | /*
|
|---|
| 2 | *
|
|---|
| 3 | * Copyright Martin von Loewis, 1994
|
|---|
| 4 | * Copyrignt 1998 Bertho A. Stultiens (BS)
|
|---|
| 5 | *
|
|---|
| 6 | * 20-Jun-1998 BS - Added -L option to prevent case conversion
|
|---|
| 7 | * of embedded filenames.
|
|---|
| 8 | *
|
|---|
| 9 | * 08-Jun-1998 BS - Added -A option to generate autoregister code
|
|---|
| 10 | * for winelib operation.
|
|---|
| 11 | *
|
|---|
| 12 | * 21-May-1998 BS - Removed the CPP option. Its internal now.
|
|---|
| 13 | * - Added implementations for defines and includes
|
|---|
| 14 | * on the commandline.
|
|---|
| 15 | *
|
|---|
| 16 | * 30-Apr-1998 BS - The options now contain nearly the entire alphabet.
|
|---|
| 17 | * Seems to be a sign for too much freedom. I implemeted
|
|---|
| 18 | * most of them as a user choice possibility for things
|
|---|
| 19 | * that I do not know what to put there by default.
|
|---|
| 20 | * - -l and -L options are now known as -t and -T.
|
|---|
| 21 | *
|
|---|
| 22 | * 23-Apr-1998 BS - Finally gave up on backward compatibility on the
|
|---|
| 23 | * commandline (after a blessing from the newsgroup).
|
|---|
| 24 | * So, I changed the lot.
|
|---|
| 25 | *
|
|---|
| 26 | * 17-Apr-1998 BS - Added many new command-line options but took care
|
|---|
| 27 | * that it would not break old scripts (sigh).
|
|---|
| 28 | *
|
|---|
| 29 | * 16-Apr-1998 BS - There is not much left of the original source...
|
|---|
| 30 | * I had to rewrite most of it because the parser
|
|---|
| 31 | * changed completely with all the types etc..
|
|---|
| 32 | *
|
|---|
| 33 | */
|
|---|
| 34 |
|
|---|
| 35 | #include "config.h"
|
|---|
| 36 |
|
|---|
| 37 | #include <stdio.h>
|
|---|
| 38 | #include <stdlib.h>
|
|---|
| 39 | #include <string.h>
|
|---|
| 40 | #include <assert.h>
|
|---|
| 41 | #include <ctype.h>
|
|---|
| 42 |
|
|---|
| 43 | #include "resource.h" /* For HAVE_WINE_CONSTRUCTOR */
|
|---|
| 44 |
|
|---|
| 45 | #include "wrc.h"
|
|---|
| 46 | #include "utils.h"
|
|---|
| 47 | #include "writeres.h"
|
|---|
| 48 | #include "readres.h"
|
|---|
| 49 | #include "dumpres.h"
|
|---|
| 50 | #include "genres.h"
|
|---|
| 51 | #include "newstruc.h"
|
|---|
| 52 | #include "preproc.h"
|
|---|
| 53 | #include "parser.h"
|
|---|
| 54 |
|
|---|
| 55 | char usage[] = "Usage: wrc [options...] [infile[.rc|.res]]\n"
|
|---|
| 56 | " -a n Alignment of resource (win16 only, default is 4)\n"
|
|---|
| 57 | " -A Auto register resources (only with gcc 2.7 and better)\n"
|
|---|
| 58 | " -b Create a C array from a binary .res file\n"
|
|---|
| 59 | " -c Add 'const' prefix to C constants\n"
|
|---|
| 60 | " -C cp Set the resource's codepage to cp (default is 0)\n"
|
|---|
| 61 | " -d n Set debug level to 'n'\n"
|
|---|
| 62 | " -D id[=val] Define preprocessor identifier id=val\n"
|
|---|
| 63 | " -e Disable recognition of win32 keywords in 16bit compile\n"
|
|---|
| 64 | " -g Add symbols to the global c namespace\n"
|
|---|
| 65 | " -h Also generate a .h file\n"
|
|---|
| 66 | " -H file Same as -h but written to file\n"
|
|---|
| 67 | " -I path Set include search dir to path (multiple -I allowed)\n"
|
|---|
| 68 | " -l lan Set default language to lan (default is neutral {0})\n"
|
|---|
| 69 | " -L Leave case of embedded filenames as is\n"
|
|---|
| 70 | " -n Do not generate .s file\n"
|
|---|
| 71 | " -o file Output to file (default is infile.[res|s|h]\n"
|
|---|
| 72 | " -p prefix Give a prefix for the generated names\n"
|
|---|
| 73 | " -r Create binary .res file (compile only)\n"
|
|---|
| 74 | " -s Add structure with win32/16 (PE/NE) resource directory\n"
|
|---|
| 75 | " -t Generate indirect loadable resource tables\n"
|
|---|
| 76 | " -T Generate only indirect loadable resources tables\n"
|
|---|
| 77 | " -V Print version end exit\n"
|
|---|
| 78 | " -w 16|32 Select win16 or win32 output (default is win32)\n"
|
|---|
| 79 | " -W Enable pedantic warnings\n"
|
|---|
| 80 | "Input is taken from stdin if no sourcefile specified.\n"
|
|---|
| 81 | "Debug level 'n' is a bitmask with following meaning:\n"
|
|---|
| 82 | " * 0x01 Tell which resource is parsed (verbose mode)\n"
|
|---|
| 83 | " * 0x02 Dump internal structures\n"
|
|---|
| 84 | " * 0x04 Create a parser trace (yydebug=1)\n"
|
|---|
| 85 | "The -o option only applies to the final destination file, which is\n"
|
|---|
| 86 | "in case of normal compile a .s file. You must use the '-H header.h'\n"
|
|---|
| 87 | "option to override the header-filename.\n"
|
|---|
| 88 | "If no input filename is given and the output name is not overridden\n"
|
|---|
| 89 | "with -o and/or -H, then the output is written to \"wrc.tab.[sh]\"\n"
|
|---|
| 90 | ;
|
|---|
| 91 |
|
|---|
| 92 | char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
|
|---|
| 93 | "Copyright 1998,1999 Bertho A. Stultiens\n"
|
|---|
| 94 | " 1994 Martin von Loewis\n";
|
|---|
| 95 |
|
|---|
| 96 | /*
|
|---|
| 97 | * Default prefix for resource names used in the C array.
|
|---|
| 98 | * Option '-p name' sets it to 'name'
|
|---|
| 99 | */
|
|---|
| 100 | #ifdef NEED_UNDERSCORE_PREFIX
|
|---|
| 101 | char *prefix = "__Resource";
|
|---|
| 102 | #else
|
|---|
| 103 | char *prefix = "_Resource";
|
|---|
| 104 | #endif
|
|---|
| 105 |
|
|---|
| 106 | /*
|
|---|
| 107 | * Set if compiling in 32bit mode (default).
|
|---|
| 108 | */
|
|---|
| 109 | int win32 = 1;
|
|---|
| 110 |
|
|---|
| 111 | /*
|
|---|
| 112 | * Set when generated C variables should be prefixed with 'const'
|
|---|
| 113 | */
|
|---|
| 114 | int constant = 0;
|
|---|
| 115 |
|
|---|
| 116 | /*
|
|---|
| 117 | * Create a .res file from the source and exit (-r option).
|
|---|
| 118 | */
|
|---|
| 119 | int create_res = 0;
|
|---|
| 120 |
|
|---|
| 121 | /*
|
|---|
| 122 | * debuglevel == DEBUGLEVEL_NONE Don't bother
|
|---|
| 123 | * debuglevel & DEBUGLEVEL_CHAT Say whats done
|
|---|
| 124 | * debuglevel & DEBUGLEVEL_DUMP Dump internal structures
|
|---|
| 125 | * debuglevel & DEBUGLEVEL_TRACE Create parser trace
|
|---|
| 126 | */
|
|---|
| 127 | int debuglevel = DEBUGLEVEL_NONE;
|
|---|
| 128 |
|
|---|
| 129 | /*
|
|---|
| 130 | * Recognize win32 keywords if set (-w 32 enforces this),
|
|---|
| 131 | * otherwise set with -e option.
|
|---|
| 132 | */
|
|---|
| 133 | int extensions = 1;
|
|---|
| 134 |
|
|---|
| 135 | /*
|
|---|
| 136 | * Set when creating C array from .res file (-b option).
|
|---|
| 137 | */
|
|---|
| 138 | int binary = 0;
|
|---|
| 139 |
|
|---|
| 140 | /*
|
|---|
| 141 | * Set when an additional C-header is to be created in compile (-h option).
|
|---|
| 142 | */
|
|---|
| 143 | int create_header = 0;
|
|---|
| 144 |
|
|---|
| 145 | /*
|
|---|
| 146 | * Set when the NE/PE resource directory should be dumped into
|
|---|
| 147 | * the output file.
|
|---|
| 148 | */
|
|---|
| 149 | int create_dir = 0;
|
|---|
| 150 |
|
|---|
| 151 | /*
|
|---|
| 152 | * Set when all symbols should be added to the global namespace (-g option)
|
|---|
| 153 | */
|
|---|
| 154 | int global = 0;
|
|---|
| 155 |
|
|---|
| 156 | /*
|
|---|
| 157 | * Set when indirect loadable resource tables should be created (-t)
|
|---|
| 158 | */
|
|---|
| 159 | int indirect = 0;
|
|---|
| 160 |
|
|---|
| 161 | /*
|
|---|
| 162 | * Set when _only_ indirect loadable resource tables should be created (-T)
|
|---|
| 163 | */
|
|---|
| 164 | int indirect_only = 0;
|
|---|
| 165 |
|
|---|
| 166 | /*
|
|---|
| 167 | * NE segment resource aligment (-a option)
|
|---|
| 168 | */
|
|---|
| 169 | int alignment = 4;
|
|---|
| 170 | int alignment_pwr;
|
|---|
| 171 |
|
|---|
| 172 | /*
|
|---|
| 173 | * Cleared when the assembly file must be suppressed (-n option)
|
|---|
| 174 | */
|
|---|
| 175 | int create_s = 1;
|
|---|
| 176 |
|
|---|
| 177 | /*
|
|---|
| 178 | * Language setting for resources (-l option)
|
|---|
| 179 | */
|
|---|
| 180 | language_t *currentlanguage = NULL;
|
|---|
| 181 |
|
|---|
| 182 | /*
|
|---|
| 183 | * The codepage to write in win32 PE resource segment (-C option)
|
|---|
| 184 | */
|
|---|
| 185 | DWORD codepage = 0;
|
|---|
| 186 |
|
|---|
| 187 | /*
|
|---|
| 188 | * Set when extra warnings should be generated (-W option)
|
|---|
| 189 | */
|
|---|
| 190 | int pedantic = 0;
|
|---|
| 191 |
|
|---|
| 192 | /*
|
|---|
| 193 | * Set when autoregister code must be added to the output (-A option)
|
|---|
| 194 | */
|
|---|
| 195 | int auto_register = 0;
|
|---|
| 196 |
|
|---|
| 197 | /*
|
|---|
| 198 | * Set when the case of embedded filenames should not be converted
|
|---|
| 199 | * to lower case (-L option)
|
|---|
| 200 | */
|
|---|
| 201 | int leave_case = 0;
|
|---|
| 202 |
|
|---|
| 203 | char *output_name; /* The name given by the -o option */
|
|---|
| 204 | char *input_name; /* The name given on the command-line */
|
|---|
| 205 | char *header_name; /* The name given by the -H option */
|
|---|
| 206 |
|
|---|
| 207 | char *cmdline; /* The entire commandline */
|
|---|
| 208 |
|
|---|
| 209 | resource_t *resource_top; /* The top of the parsed resources */
|
|---|
| 210 |
|
|---|
| 211 | int getopt (int argc, char *const *argv, const char *optstring);
|
|---|
| 212 |
|
|---|
| 213 | int main(int argc,char *argv[])
|
|---|
| 214 | {
|
|---|
| 215 | extern char* optarg;
|
|---|
| 216 | extern int optind;
|
|---|
| 217 | int optc;
|
|---|
| 218 | int lose = 0;
|
|---|
| 219 | int ret;
|
|---|
| 220 | int a;
|
|---|
| 221 | int i;
|
|---|
| 222 | int cmdlen;
|
|---|
| 223 |
|
|---|
| 224 | /* First rebuild the commandline to put in destination */
|
|---|
| 225 | /* Could be done through env[], but not all OS-es support it */
|
|---|
| 226 | cmdlen = 4; /* for "wrc " */
|
|---|
| 227 | for(i = 1; i < argc; i++)
|
|---|
| 228 | cmdlen += strlen(argv[i]) + 1;
|
|---|
| 229 | cmdline = (char *)xmalloc(cmdlen);
|
|---|
| 230 | strcpy(cmdline, "wrc ");
|
|---|
| 231 | for(i = 1; i < argc; i++)
|
|---|
| 232 | {
|
|---|
| 233 | strcat(cmdline, argv[i]);
|
|---|
| 234 | if(i < argc-1)
|
|---|
| 235 | strcat(cmdline, " ");
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 | while((optc = getopt(argc, argv, "a:AbcC:d:D:eghH:I:l:Lno:p:rstTVw:W")) != EOF)
|
|---|
| 239 | {
|
|---|
| 240 | switch(optc)
|
|---|
| 241 | {
|
|---|
| 242 | case 'a':
|
|---|
| 243 | alignment = atoi(optarg);
|
|---|
| 244 | break;
|
|---|
| 245 | case 'A':
|
|---|
| 246 | auto_register = 1;
|
|---|
| 247 | break;
|
|---|
| 248 | case 'b':
|
|---|
| 249 | binary = 1;
|
|---|
| 250 | break;
|
|---|
| 251 | case 'c':
|
|---|
| 252 | constant = 1;
|
|---|
| 253 | break;
|
|---|
| 254 | case 'C':
|
|---|
| 255 | codepage = strtol(optarg, NULL, 0);
|
|---|
| 256 | break;
|
|---|
| 257 | case 'd':
|
|---|
| 258 | debuglevel = strtol(optarg, NULL, 0);
|
|---|
| 259 | break;
|
|---|
| 260 | case 'D':
|
|---|
| 261 | add_cmdline_define(optarg);
|
|---|
| 262 | break;
|
|---|
| 263 | case 'e':
|
|---|
| 264 | extensions = 0;
|
|---|
| 265 | break;
|
|---|
| 266 | case 'g':
|
|---|
| 267 | global = 1;
|
|---|
| 268 | break;
|
|---|
| 269 | case 'H':
|
|---|
| 270 | header_name = strdup(optarg);
|
|---|
| 271 | /* Fall through */
|
|---|
| 272 | case 'h':
|
|---|
| 273 | create_header = 1;
|
|---|
| 274 | break;
|
|---|
| 275 | case 'I':
|
|---|
| 276 | add_include_path(optarg);
|
|---|
| 277 | break;
|
|---|
| 278 | case 'l':
|
|---|
| 279 | {
|
|---|
| 280 | int lan;
|
|---|
| 281 | lan = strtol(optarg, NULL, 0);
|
|---|
| 282 | currentlanguage = new_language(PRIMARYLANGID(lan), SUBLANGID(lan));
|
|---|
| 283 | }
|
|---|
| 284 | break;
|
|---|
| 285 | case 'L':
|
|---|
| 286 | leave_case = 1;
|
|---|
| 287 | break;
|
|---|
| 288 | case 'n':
|
|---|
| 289 | create_s = 0;
|
|---|
| 290 | break;
|
|---|
| 291 | case 'o':
|
|---|
| 292 | output_name = strdup(optarg);
|
|---|
| 293 | break;
|
|---|
| 294 | case 'p':
|
|---|
| 295 | #ifdef NEED_UNDERSCORE_PREFIX
|
|---|
| 296 | prefix = (char *)xmalloc(strlen(optarg)+2);
|
|---|
| 297 | prefix[0] = '_';
|
|---|
| 298 | strcpy(prefix+1, optarg);
|
|---|
| 299 | #else
|
|---|
| 300 | prefix = xstrdup(optarg);
|
|---|
| 301 | #endif
|
|---|
| 302 | break;
|
|---|
| 303 | case 'r':
|
|---|
| 304 | create_res = 1;
|
|---|
| 305 | break;
|
|---|
| 306 | case 's':
|
|---|
| 307 | create_dir = 1;
|
|---|
| 308 | break;
|
|---|
| 309 | case 'T':
|
|---|
| 310 | indirect_only = 1;
|
|---|
| 311 | /* Fall through */
|
|---|
| 312 | case 't':
|
|---|
| 313 | indirect = 1;
|
|---|
| 314 | break;
|
|---|
| 315 | case 'V':
|
|---|
| 316 | printf(version_string);
|
|---|
| 317 | exit(0);
|
|---|
| 318 | break;
|
|---|
| 319 | case 'w':
|
|---|
| 320 | if(!strcmp(optarg, "16"))
|
|---|
| 321 | win32 = 0;
|
|---|
| 322 | else if(!strcmp(optarg, "32"))
|
|---|
| 323 | win32 = 1;
|
|---|
| 324 | else
|
|---|
| 325 | lose++;
|
|---|
| 326 | break;
|
|---|
| 327 | case 'W':
|
|---|
| 328 | pedantic = 1;
|
|---|
| 329 | break;
|
|---|
| 330 | default:
|
|---|
| 331 | lose++;
|
|---|
| 332 | break;
|
|---|
| 333 | }
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| 336 | if(lose)
|
|---|
| 337 | {
|
|---|
| 338 | fprintf(stderr, usage);
|
|---|
| 339 | return 1;
|
|---|
| 340 | }
|
|---|
| 341 |
|
|---|
| 342 | /* Check the command line options for invalid combinations */
|
|---|
| 343 | if(win32)
|
|---|
| 344 | {
|
|---|
| 345 | if(!extensions)
|
|---|
| 346 | {
|
|---|
| 347 | warning("Option -e ignored with 32bit compile\n");
|
|---|
| 348 | extensions = 1;
|
|---|
| 349 | }
|
|---|
| 350 | }
|
|---|
| 351 |
|
|---|
| 352 | if(create_res)
|
|---|
| 353 | {
|
|---|
| 354 | if(constant)
|
|---|
| 355 | {
|
|---|
| 356 | warning("Option -c ignored with compile to .res\n");
|
|---|
| 357 | constant = 0;
|
|---|
| 358 | }
|
|---|
| 359 |
|
|---|
| 360 | if(create_header)
|
|---|
| 361 | {
|
|---|
| 362 | warning("Option -[h|H] ignored with compile to .res\n");
|
|---|
| 363 | create_header = 0;
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | if(indirect)
|
|---|
| 367 | {
|
|---|
| 368 | warning("Option -l ignored with compile to .res\n");
|
|---|
| 369 | indirect = 0;
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | if(indirect_only)
|
|---|
| 373 | {
|
|---|
| 374 | warning("Option -L ignored with compile to .res\n");
|
|---|
| 375 | indirect_only = 0;
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | if(global)
|
|---|
| 379 | {
|
|---|
| 380 | warning("Option -g ignored with compile to .res\n");
|
|---|
| 381 | global = 0;
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | if(create_dir)
|
|---|
| 385 | {
|
|---|
| 386 | error("Option -r and -s cannot be used together\n");
|
|---|
| 387 | }
|
|---|
| 388 |
|
|---|
| 389 | if(binary)
|
|---|
| 390 | {
|
|---|
| 391 | error("Option -r and -b cannot be used together\n");
|
|---|
| 392 | }
|
|---|
| 393 | }
|
|---|
| 394 |
|
|---|
| 395 | #if !defined(HAVE_WINE_CONSTRUCTOR)
|
|---|
| 396 | if(auto_register)
|
|---|
| 397 | {
|
|---|
| 398 | warning("Autoregister code non-operable (HAVE_WINE_CONSTRUCTOR not defined)");
|
|---|
| 399 | auto_register = 0;
|
|---|
| 400 | }
|
|---|
| 401 | #endif
|
|---|
| 402 |
|
|---|
| 403 | /* Set alignment power */
|
|---|
| 404 | a = alignment;
|
|---|
| 405 | for(alignment_pwr = 0; alignment_pwr < 10 && a > 1; alignment_pwr++)
|
|---|
| 406 | {
|
|---|
| 407 | a >>= 1;
|
|---|
| 408 | }
|
|---|
| 409 | if(a != 1)
|
|---|
| 410 | {
|
|---|
| 411 | error("Alignment must be between 1 and 1024");
|
|---|
| 412 | }
|
|---|
| 413 | if((1 << alignment_pwr) != alignment)
|
|---|
| 414 | {
|
|---|
| 415 | error("Alignment must be a power of 2");
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 | /* Kill io buffering when some kind of debuglevel is enabled */
|
|---|
| 419 | if(debuglevel)
|
|---|
| 420 | {
|
|---|
| 421 | setbuf(stdout,0);
|
|---|
| 422 | setbuf(stderr,0);
|
|---|
| 423 | }
|
|---|
| 424 |
|
|---|
| 425 | yydebug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;
|
|---|
| 426 |
|
|---|
| 427 | /* Set the default defined stuff */
|
|---|
| 428 | add_cmdline_define("RC_INVOKED=1");
|
|---|
| 429 | add_cmdline_define("__WRC__=1");
|
|---|
| 430 | if(win32)
|
|---|
| 431 | {
|
|---|
| 432 | add_cmdline_define("__WIN32__=1");
|
|---|
| 433 | add_cmdline_define("__FLAT__=1");
|
|---|
| 434 | }
|
|---|
| 435 |
|
|---|
| 436 | /* Check if the user set a language, else set default */
|
|---|
| 437 | if(!currentlanguage)
|
|---|
| 438 | currentlanguage = new_language(0, 0);
|
|---|
| 439 |
|
|---|
| 440 | /* Check for input file on command-line */
|
|---|
| 441 | if(optind < argc)
|
|---|
| 442 | {
|
|---|
| 443 | input_name = argv[optind];
|
|---|
| 444 | yyin = fopen(input_name, "rb");
|
|---|
| 445 | if(!yyin)
|
|---|
| 446 | {
|
|---|
| 447 | error("Could not open %s\n", input_name);
|
|---|
| 448 | }
|
|---|
| 449 | }
|
|---|
| 450 | else
|
|---|
| 451 | {
|
|---|
| 452 | yyin = stdin;
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | if(binary && !input_name)
|
|---|
| 456 | {
|
|---|
| 457 | error("Binary mode requires .res file as input");
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | if(!output_name)
|
|---|
| 461 | {
|
|---|
| 462 | output_name = dup_basename(input_name, binary ? ".res" : ".rc");
|
|---|
| 463 | strcat(output_name, create_res ? ".res" : ".s");
|
|---|
| 464 | }
|
|---|
| 465 |
|
|---|
| 466 | if(!header_name && !create_res)
|
|---|
| 467 | {
|
|---|
| 468 | header_name = dup_basename(input_name, binary ? ".res" : ".rc");
|
|---|
| 469 | strcat(header_name, ".h");
|
|---|
| 470 | }
|
|---|
| 471 |
|
|---|
| 472 | if(!binary)
|
|---|
| 473 | {
|
|---|
| 474 | /* Go from .rc to .res or .s */
|
|---|
| 475 | chat("Starting parse");
|
|---|
| 476 | ret = yyparse();
|
|---|
| 477 |
|
|---|
| 478 | if(input_name)
|
|---|
| 479 | fclose(yyin);
|
|---|
| 480 |
|
|---|
| 481 | if(ret)
|
|---|
| 482 | {
|
|---|
| 483 | /* Error during parse */
|
|---|
| 484 | exit(1);
|
|---|
| 485 | }
|
|---|
| 486 |
|
|---|
| 487 | if(debuglevel & DEBUGLEVEL_DUMP)
|
|---|
| 488 | dump_resources(resource_top);
|
|---|
| 489 |
|
|---|
| 490 | /* Convert the internal lists to binary data */
|
|---|
| 491 | resources2res(resource_top);
|
|---|
| 492 |
|
|---|
| 493 | if(create_res)
|
|---|
| 494 | {
|
|---|
| 495 | chat("Writing .res-file");
|
|---|
| 496 | write_resfile(output_name, resource_top);
|
|---|
| 497 | }
|
|---|
| 498 | else
|
|---|
| 499 | {
|
|---|
| 500 | if(create_s)
|
|---|
| 501 | {
|
|---|
| 502 | chat("Writing .s-file");
|
|---|
| 503 | write_s_file(output_name, resource_top);
|
|---|
| 504 | }
|
|---|
| 505 | if(create_header)
|
|---|
| 506 | {
|
|---|
| 507 | chat("Writing .h-file");
|
|---|
| 508 | write_h_file(header_name, resource_top);
|
|---|
| 509 | }
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 | }
|
|---|
| 513 | else
|
|---|
| 514 | {
|
|---|
| 515 | /* Go from .res to .s */
|
|---|
| 516 | chat("Reading .res-file");
|
|---|
| 517 | resource_top = read_resfile(input_name);
|
|---|
| 518 | if(create_s)
|
|---|
| 519 | {
|
|---|
| 520 | chat("Writing .s-file");
|
|---|
| 521 | write_s_file(output_name, resource_top);
|
|---|
| 522 | }
|
|---|
| 523 | if(create_header)
|
|---|
| 524 | {
|
|---|
| 525 | chat("Writing .h-file");
|
|---|
| 526 | write_h_file(header_name, resource_top);
|
|---|
| 527 | }
|
|---|
| 528 | }
|
|---|
| 529 |
|
|---|
| 530 | return 0;
|
|---|
| 531 | }
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 |
|
|---|