Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 542 → Rev 581

/svarcom/tags/svarcom-2022.0/tlumacz/lang/english.txt
0,0 → 1,60
#
# SvarCOM translation file
# Lang: ENGLISH
#
# Translator: Mateusz Viste
#
 
# GENERIC MESSAGES USED BY MULTIPLE INTERNAL COMMANDS
0.1:Invalid syntax
0.2:Invalid switch
0.3:Invalid parameter format
0.4:Too many parameters
 
# PAUSE
15.0:Suspends the execution of a batch script
15.1:Press any key to continue...
 
# SHIFT
16.0:Changes the position of arguments in a batch file:
16.1:Argument %1 becomes %0, argument %2 becomes %1, etc.
 
# DOS ERRORS
255.1:Function number invalid
255.2:File not found
255.3:Path not found
255.4:Too many open files (no handles available)
255.5:Access denied
255.6:Invalid handle
255.7:Memory control block destroyed
255.8:Insufficient memory
255.9:Memory block address invalid
255.10:Environment invalid
255.11:Format invalid
255.12:Access code invalid
255.13:Data invalid
255.15:Invalid drive
255.16:Attempted to remove current directory
255.17:Not same device
255.18:No more files
255.19:Disk write-protected
255.20:Unknown unit
255.21:Drive not ready
255.22:Unknown command
255.23:Data error (CRC)
255.24:Bad request structure length
255.25:Seek error
255.26:Unknown media type (non-DOS disk)
255.27:Sector not found
255.28:Printer out of paper
255.29:Write fault
255.30:Read fault
255.31:General failure
255.32:Sharing violation
255.33:Lock violation
255.34:Disk change invalid
255.35:FCB unavailable
255.36:Sharing buffer overflow
255.37:Code page mismatch
255.38:Cannot complete file operations (EOF / out of input)
255.39:Insufficient disk space
/svarcom/tags/svarcom-2022.0/tlumacz/lang/french.txt
0,0 → 1,14
#
# SvarCOM translation file
# Lang: FRENCH
#
# Translator: Mateusz Viste
#
 
# PAUSE
15.0:Suspends l'exécution d'un programme batch
15.1:Appuyez sur une touche pour continuer...
 
# SHIFT
16.0:Change la position des arguments dans un fichier batch:
16.1:L'argument %1 devient %0, l'argument %2 devient %1, etc.
/svarcom/tags/svarcom-2022.0/tlumacz/lang/polish.txt
0,0 → 1,54
#
# SvarCOM translation file
# Lang: POLISH
#
# Translator: Mateusz Viste
#
 
# PAUSE
15.0:Wstrzymuje przetwarzanie pliku wsadowego
15.1:Naciśnij dowolny klawisz aby kontynuować...
 
# SHIFT
16.0:Zmienia pozycję argumentów w pliku wsadowym:
16.1:Argument %1 staje się %0, argument %2 staje się %1, itd.
 
# DOS ERRORS
255.1:Błędny numer funkcji
255.2:Nie znaleziono pliku
255.3:Nie znaleziono ścieżki
255.4:Zbyt wiele otwartych plików (brak dostępnych uchwytów)
255.5:Brak dostępu
255.6:Nieprawidłowy uchwyt
255.7:Zniszczony blok kontroli pamięci
255.8:Niewystarczająca pamięć
255.9:Nieprawidłowy adres bloku pamięci
255.10:Nieprawidłowe środowisko
255.11:Nieprawidłowy format
255.12:Nieprawidłowy kod dostepu
255.13:Nieprawidłowe dane
255.15:Nieprawidłowy napęd
255.16:Dokonano próby usunięcia bieżącego katalogu
255.17:Nie to samo urządzenie
255.18:Brak dalszych plików
255.19:Dysk chroniony przed zapisem
255.20:Nieznana jednostka
255.21:Napęd nie jest gotowy
255.22:Nieznane polecenie
255.23:Błąd danych (CRC)
255.24:Nieprawidłowa długość struktury zapytania
255.25:Błąd wyszukiwania
255.26:Nieznany typ nośnika (dysk niezgodny z DOS)
255.27:Nie znaleziono sektora
255.28:Brak papieru w drukarce
255.29:Błąd zapisu
255.30:Błąd odczytu
255.31:Ogólna awaria
255.32:Naruszenie zasad współdzielenia
255.33:Naruszenie blokady
255.34:Nieprawidłowa zmiana dysku
255.35:Niedostępne FCB
255.36:Przepełnienie bufora udostępniania
255.37:Niezgodność strony kodowej
255.38:Nie można ukończyć operacji na pliku (EOF / brak danych wejściowych)
255.39:Za mało miejsca na dysku
/svarcom/tags/svarcom-2022.0/tlumacz/makefile
0,0 → 1,14
#
# make instructions to build tlumacz.exe with OpenWatcom
# Copyright (C) 2021 Mateusz Viste
#
 
all: tlumacz.exe
 
tlumacz.exe: tlumacz.c
wcl -0 -y -cc -wx -mc -lr -we -ox tlumacz.c
del *.obj
 
clean: .symbolic
del *.exe
del *.obj
/svarcom/tags/svarcom-2022.0/tlumacz/nlsgen.bat
0,0 → 1,17
@ECHO OFF
 
MKDIR NLS
 
REM copy english translations as-is
COPY LANG\ENGLISH.TXT NLS\SVARCOM.EN
 
REM GENERATE CODEPAGE-SPECIFIG VERSIONS OUT OF UTF-8 FILES
utf8tocp 850 LANG\FRENCH.TXT > NLS\SVARCOM.FR
utf8tocp maz LANG\POLISH.TXT > NLS\SVARCOM.PL
 
REM COMPILE ALL RESOURCES TOGETHER
tlumacz en fr pl
 
REM CLEAN UP
DEL NLS\SVARCOM.*
RMDIR NLS
/svarcom/tags/svarcom-2022.0/tlumacz/tlumacz.c
0,0 → 1,269
/*
* Copyright (C) 2021 Mateusz Viste
*
* usage: tlumacz en fr pl etc
*
* computes a svarcom.lng file that contains all language ressources found
* inside dirname.
*
* DAT format:
*
* 4-bytes signature:
* "SvL\x1b"
*
* Then "LANG BLOCKS" follow. Each LANG BLOCK is prefixed with 4 bytes:
* II LL - II is the LANG identifier ("EN", "PL", etc) and LL is the size
* of the block (65535 bytes max).
*
* Inside a LANG BLOCK is a set of strings:
*
* II L S where II is the string's 16-bit identifier, L is its length (1-255)
* and S is the actual string. All strings are ASCIIZ-formatted (ie.
* end with a NULL terminator).
*
* The list of strings ends with a single 0-long string.
*/
 
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
 
 
struct bitmap {
unsigned char bits[8192];
};
 
static void bitmap_set(struct bitmap *b, unsigned short id) {
b->bits[id / 8] |= 1 << (id & 7);
}
 
static int bitmap_get(const struct bitmap *b, unsigned short id) {
return(b->bits[id / 8] & (1 << (id & 7)));
}
 
static void bitmap_init(struct bitmap *b) {
memset(b, 0, sizeof(struct bitmap));
}
 
 
 
/* read a single line from fd and fills it into dst, returns line length
* ending CR/LF is trimmed, as well as any trailing spaces */
static unsigned short readl(char *dst, size_t dstsz, FILE *fd) {
unsigned short l, lastnonspace = 0;
 
if (fgets(dst, dstsz, fd) == NULL) return(0xffff); /* EOF */
/* trim at first CR or LF and return len */
for (l = 0; (dst[l] != 0) && (dst[l] != '\r') && (dst[l] != '\n'); l++) {
if (dst[l] != ' ') lastnonspace = l;
}
 
if (lastnonspace < l) l = lastnonspace + 1; /* rtrim */
dst[l] = 0;
 
return(l);
}
 
 
/* parse a line in format "1.50:somestring". fills id and returns a pointer to
* the actual string part on success, or NULL on error */
static char *parseline(unsigned short *id, char *s) {
int i;
int dotpos = 0, colpos = 0, gotdigits = 0;
 
/* I must have a . and a : in the first 9 bytes */
for (i = 0;; i++) {
if (s[i] == '.') {
if ((dotpos != 0) || (gotdigits == 0)) break;
dotpos = i;
gotdigits = 0;
} else if (s[i] == ':') {
if (gotdigits != 0) colpos = i;
break;
} else if ((s[i] < '0') || (s[i] > '9')) {
break;
}
gotdigits++;
}
/* did I collect everything? */
if ((dotpos == 0) || (colpos == 0)) return(NULL);
if (s[colpos + 1] == 0) return(NULL);
 
*id = atoi(s);
*id <<= 8;
*id |= atoi(s + dotpos + 1);
 
/* printf("parseline(): %04X = '%s'\r\n", *id, s + colpos + 1); */
 
return(s + colpos + 1);
}
 
 
/* opens a CATS-style file and compiles it into a ressources lang block */
static unsigned short gen_langstrings(unsigned char *buff, const char *langid, struct bitmap *b, const struct bitmap *refb, const unsigned char *refblock) {
unsigned short len = 0, linelen;
FILE *fd;
char fname[] = "NLS\\SVARCOM.XX";
char linebuf[512];
char *ptr;
unsigned short id, linecount;
 
bitmap_init(b);
 
strcpy(fname + strlen(fname) - 2, langid);
 
fd = fopen(fname, "rb");
if (fd == NULL) {
printf("ERROR: FAILED TO OPEN '%s'\r\n", fname);
return(0);
}
 
for (linecount = 1;; linecount++) {
 
linelen = readl(linebuf, sizeof(linebuf), fd);
if (linelen == 0xffff) break; /* EOF */
if ((linelen == 0) || (linebuf[0] == '#')) continue;
 
/* read id and get ptr to actual string ("1.15:string") */
ptr = parseline(&id, linebuf);
if (ptr == NULL) {
printf("ERROR: line #%u of %s is malformed\r\n", linecount, fname);
len = 0;
break;
}
 
/* write string into block (II L S) */
memcpy(buff + len, &id, 2);
len += 2;
buff[len++] = strlen(ptr) + 1;
memcpy(buff + len, ptr, strlen(ptr) + 1);
len += strlen(ptr) + 1;
 
/* if reference bitmap provided: check that the id is valid */
if ((refb != NULL) && (bitmap_get(refb, id) == 0)) {
printf("WARNING: %s[#%u] has an invalid id (%u.%u not present in ref lang)\r\n", fname, linecount, id >> 8, id & 0xff);
}
 
/* make sure this id is not already present */
if (bitmap_get(b, id) == 0) {
/* set bit in bitmap to remember I have this string */
bitmap_set(b, id);
} else {
printf("WARNING: %s[#%u] has a duplicated id (%u.%u)\r\n", fname, linecount, id >> 8, id & 0xff);
}
}
 
fclose(fd);
 
/* if refblock provided, pull missing strings from it */
if (refblock != NULL) {
for (;;) {
id = *((unsigned short *)refblock);
if ((id == 0) && (refblock[2] == 0)) break;
if (bitmap_get(b, id) == 0) {
printf("WARNING: %s is missing string %u.%u (pulled from ref lang)\r\n", fname, id >> 8, id & 0xff);
/* copy missing string from refblock */
memcpy(buff + len, refblock, refblock[2] + 3);
len += refblock[2] + 3;
}
refblock += refblock[2] + 3;
}
}
 
/* write the block terminator (0-long string) */
buff[len++] = 0; /* id */
buff[len++] = 0; /* id */
buff[len++] = 0; /* len */
 
return(len);
}
 
 
#define MEMBLOCKSZ 65500
 
int main(int argc, char **argv) {
FILE *fd;
int ecode = 0;
char *buff, *refblock;
static struct bitmap bufbitmap;
static struct bitmap refbitmap;
unsigned short i;
 
if (argc < 2) {
puts("usage: tlumacz en fr pl etc");
return(1);
}
 
buff = malloc(MEMBLOCKSZ);
refblock = malloc(MEMBLOCKSZ);
if ((buff == NULL) || (refblock == NULL)) {
puts("out of memory");
return(1);
}
 
fd = fopen("svarcom.lng", "wb");
if (fd == NULL) {
puts("ERR: failed to open or create SVARCOM.LNG");
return(1);
}
 
/* write sig */
fwrite("SvL\x1b", 1, 4, fd);
 
/* write lang blocks */
for (i = 1; i < argc; i++) {
unsigned short sz;
char id[3];
 
if (strlen(argv[i]) != 2) {
printf("INVALID LANG SPECIFIED: %s\r\n", argv[i]);
ecode = 1;
break;
}
 
id[0] = argv[i][0];
id[1] = argv[i][1];
id[2] = 0;
if (id[0] >= 'a') id[0] -= 'a' - 'A';
if (id[1] >= 'a') id[1] -= 'a' - 'A';
 
sz = gen_langstrings(buff, id, &bufbitmap, (i != 1)?&refbitmap:NULL, (i != 1)?refblock:NULL);
if (sz == 0) {
printf("ERROR COMPUTING LANG '%s'\r\n", id);
ecode = 1;
break;
} else {
printf("computed %s lang block of %u bytes\r\n", id, sz);
}
/* write lang ID to file, followed by block size and then the actual block */
if ((fwrite(id, 1, 2, fd) != 2) ||
(fwrite(&sz, 1, 2, fd) != 2) ||
(fwrite(buff, 1, sz, fd) != sz)) {
printf("ERROR WRITING TO OUTPUT FILE\r\n");
ecode = 1;
break;
}
/* compute the default block for reference language */
if (i == 1) {
FILE *fd2;
fd2 = fopen("DEFAULT.LNG", "wb");
if (fd2 == NULL) {
puts("ERROR: FAILED TO OPEN OR CREATE DEFAULT.LNG");
break;
}
fwrite(id, 1, 2, fd2); /* lang block id */
fwrite(&sz, 1, 2, fd2); /* lang block size */
fwrite(buff, 1, sz, fd2); /* langblock content (strings) */
fclose(fd2);
/* remember reference data for other languages */
memcpy(refblock, buff, MEMBLOCKSZ);
memcpy(&refbitmap, &bufbitmap, sizeof(struct bitmap));
}
}
 
fclose(fd);
 
return(ecode);
}
/svarcom/tags/svarcom-2022.0/tlumacz/tlumacz.txt
0,0 → 1,14
tlumacz is a "compiler" that builds the SvarCOM multi-lang ressource file out
of a collection of CATS/Kitten text files.
 
usage: tlumacz en fr pl ...
 
tlumacz generates a SVARCOM.LNG file that contains all language ressources.
This file must be then placed in the %NLSPATH% directory so SvarCOM can find it.
SvarCOM's language is controlled by the LANG variable (eg. "SET LANG=PL").
 
the first language acts as a reference, its strings will be used to fill any
missing translations in other files.
 
a DEFAULT.LNG file is also generated, it contains only translation strings for
the reference language. This file is only useful for building SvarCOM.