Subversion Repositories SvarDOS

Rev

Rev 2092 | Rev 2095 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2092 Rev 2094
Line 539... Line 539...
539
int main(int argc, char **argv) {
539
int main(int argc, char **argv) {
540
  FILE *fd;
540
  FILE *fd;
541
  int ecode = 0;
541
  int ecode = 0;
542
  int i, output_format = C_OUTPUT;
542
  int i, output_format = C_OUTPUT;
543
  int mvcomp_enabled = 1;
543
  int mvcomp_enabled = 1;
-
 
544
  int excref = 0;
544
  unsigned short biggest_langsz = 0;
545
  unsigned short biggest_langsz = 0;
545
  struct svl_lang *lang = NULL, *reflang = NULL;
546
  struct svl_lang *lang = NULL, *reflang = NULL;
546
 
547
 
547
  if (argc < 2) {
548
  if (argc < 2) {
548
    puts("tlumacz ver " SVARLANGVER " - this tool is part of the SvarLANG project.");
549
    puts("tlumacz ver " SVARLANGVER " - this tool is part of the SvarLANG project.");
549
    puts("converts a set of CATS-style translations in files EN.TXT, PL.TXT, etc");
550
    puts("converts a set of CATS-style translations in files EN.TXT, PL.TXT, etc");
550
    puts("into a single resource file (OUT.LNG).");
551
    puts("into a single resource file (OUT.LNG). Also generates a deflang source");
-
 
552
    puts("file that contains a properly sized buffer pre-filled with the first");
-
 
553
    puts("(reference) language.");
551
    puts("");
554
    puts("");
552
    puts("usage: tlumacz [/c | /asm | /nasm] [/nocomp] en fr pl ...");
555
    puts("usage: tlumacz [/c | /asm | /nasm] [/nocomp] en fr pl ...");
553
    puts("");
556
    puts("");
554
    puts("/c      - generates deflang.c (default)");
557
    puts("/c        generates deflang.c (default)");
555
    puts("/asm    - deflang ASM output");
558
    puts("/asm      deflang ASM output");
556
    puts("/nasm   - deflang NASM output");
559
    puts("/nasm     deflang NASM output");
557
    puts("/nocomp - disables compression of strings in the LNG file");
560
    puts("/nocomp   disables compression of strings in the LNG file");
-
 
561
    puts("/excref   excludes ref lang from the LNG file (inserted to deflang only)");
558
    return(1);
562
    return(1);
559
  }
563
  }
560
 
564
 
561
  fd = fopen("out.lng", "wb");
565
  fd = fopen("out.lng", "wb");
562
  if (fd == NULL) {
566
  if (fd == NULL) {
Line 579... Line 583...
579
      output_format = NASM_OUTPUT;
583
      output_format = NASM_OUTPUT;
580
      continue;
584
      continue;
581
    } else if(!strcmp(argv[i], "/nocomp")) {
585
    } else if(!strcmp(argv[i], "/nocomp")) {
582
      mvcomp_enabled = 0;
586
      mvcomp_enabled = 0;
583
      continue;
587
      continue;
-
 
588
    } else if(!strcmp(argv[i], "/excref")) {
-
 
589
      excref = 1;
-
 
590
      continue;
584
    }
591
    }
585
 
592
 
586
    if (strlen(argv[i]) != 2) {
593
    if (strlen(argv[i]) != 2) {
587
      fprintf(stderr, "INVALID LANG SPECIFIED: %s\r\n", argv[i]);
594
      fprintf(stderr, "INVALID LANG SPECIFIED: %s\r\n", argv[i]);
588
      ecode = 1;
595
      ecode = 1;
Line 617... Line 624...
617
        goto exit_main;
624
        goto exit_main;
618
      }
625
      }
619
    }
626
    }
620
 
627
 
621
    /* write lang ID to file, followed string table size, and then
628
    /* write lang ID to file, followed string table size, and then
622
       the dictionary and string table for current language */
629
       the dictionary and string table for current language
-
 
630
       skip this for reference language if /excref given */
-
 
631
    if ((reflang != NULL) || (excref == 0)) {
623
    if (!svl_write_lang(lang, fd, mvcomp_enabled)) {
632
      if (!svl_write_lang(lang, fd, mvcomp_enabled)) {
624
      fprintf(stderr, "ERROR WRITING TO OUTPUT FILE\r\n");
633
        fprintf(stderr, "ERROR WRITING TO OUTPUT FILE\r\n");
625
      ecode = 1;
634
        ecode = 1;
626
      goto exit_main;
635
        goto exit_main;
-
 
636
      }
627
    }
637
    }
628
 
638
 
629
    /* remember reference data for other languages */
639
    /* remember reference data for other languages */
630
    if (!reflang) {
640
    if (!reflang) {
631
      reflang = lang;
641
      reflang = lang;