Subversion Repositories SvarDOS

Rev

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

Rev 1114 Rev 1247
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2021-2022 Mateusz Viste
2
 * Copyright (C) 2021-2023 Mateusz Viste
3
 *
3
 *
4
 * usage: tlumacz en fr pl etc
4
 * usage: tlumacz en fr pl etc
5
 *
5
 *
6
 * computes an out.lng file that contains all language ressources.
6
 * computes an out.lng file that contains all language ressources.
7
 *
7
 *
Line 26... Line 26...
26
 
26
 
27
#include <stdio.h>
27
#include <stdio.h>
28
#include <stdlib.h>
28
#include <stdlib.h>
29
#include <string.h>
29
#include <string.h>
30
 
30
 
-
 
31
#include "version.h"
31
 
32
 
32
 
33
 
33
struct bitmap {
34
struct bitmap {
34
  unsigned char bits[8192];
35
  unsigned char bits[8192];
35
};
36
};
Line 236... Line 237...
236
  static struct bitmap refbitmap;
237
  static struct bitmap refbitmap;
237
  unsigned short i;
238
  unsigned short i;
238
  unsigned short biggest_langsz = 0;
239
  unsigned short biggest_langsz = 0;
239
 
240
 
240
  if (argc < 2) {
241
  if (argc < 2) {
-
 
242
    puts("tlumacz ver " SVARLANGVER " - this tool is part of the SvarLANG project.");
-
 
243
    puts("converts a set of CATS-style translations in files EN.TXT, PL.TXT, etc");
-
 
244
    puts("into a single resource file (OUT.LNG).");
-
 
245
    puts("");
241
    puts("usage: tlumacz en fr pl etc");
246
    puts("usage: tlumacz en fr pl ...");
242
    return(1);
247
    return(1);
243
  }
248
  }
244
 
249
 
245
  buff = malloc(MEMBLOCKSZ);
250
  buff = malloc(MEMBLOCKSZ);
246
  refblock = malloc(MEMBLOCKSZ);
251
  refblock = malloc(MEMBLOCKSZ);
Line 307... Line 312...
307
  if (fd == NULL) {
312
  if (fd == NULL) {
308
    puts("ERROR: FAILED TO OPEN OR CREATE DEFLANG.C");
313
    puts("ERROR: FAILED TO OPEN OR CREATE DEFLANG.C");
309
    ecode = 1;
314
    ecode = 1;
310
  } else {
315
  } else {
311
    unsigned short allocsz = biggest_langsz + (biggest_langsz / 20);
316
    unsigned short allocsz = biggest_langsz + (biggest_langsz / 20);
312
    printf("biggest lang block is %u bytes -> allocating a %u bytes buffer\n", biggest_langsz, allocsz);
317
    printf("biggest lang block is %u bytes -> allocating a %u bytes buffe (5%% safety margin)r\n", biggest_langsz, allocsz);
313
    fprintf(fd, "/* THIS FILE HAS BEEN GENERATED BY TLUMACZ (PART OF THE SVARLANG LIBRARY) */\r\n");
318
    fprintf(fd, "/* THIS FILE HAS BEEN GENERATED BY TLUMACZ (PART OF THE SVARLANG LIBRARY) */\r\n");
314
    fprintf(fd, "const unsigned short svarlang_memsz = %uu;\r\n", allocsz);
319
    fprintf(fd, "const unsigned short svarlang_memsz = %uu;\r\n", allocsz);
315
    fprintf(fd, "char svarlang_mem[%u] = {\r\n", allocsz);
320
    fprintf(fd, "char svarlang_mem[%u] = {\r\n", allocsz);
316
    for (i = 0; i < refblocksz; i++) {
321
    for (i = 0; i < refblocksz; i++) {
317
      fprintf(fd, "%u", refblock[i]);
322
      fprintf(fd, "%u", refblock[i]);