//svarlang.lib/trunk/makefile |
---|
1,6 → 1,6 |
# |
# make instructions to build svarlang and tlumacz.exe with OpenWatcom |
# Copyright (C) 2021-2022 Mateusz Viste |
# Copyright (C) 2021-2023 Mateusz Viste |
# |
all: svarlngs.lib svarlngc.lib svarlngm.lib svarlngl.lib tlumacz.exe |
7,29 → 7,33 |
CFLAGS=-0 -wx -we -ox |
svarlngs.lib: autoload.c svarlang.c |
svarlngs.lib: autoload.c svarlang.c version.c |
wcc $(CFLAGS) -ms autoload.c |
wcc $(CFLAGS) -ms svarlang.c |
wcc $(CFLAGS) -ms version.c |
if exist svarlngs.lib del svarlngs.lib |
wlib -n svarlngs.lib +autoload.obj +svarlang.obj |
wlib -n svarlngs.lib +autoload.obj +svarlang.obj +version.obj |
svarlngc.lib: autoload.c svarlang.c |
svarlngc.lib: autoload.c svarlang.c version.c |
wcc $(CFLAGS) -mc autoload.c |
wcc $(CFLAGS) -mc svarlang.c |
wcc $(CFLAGS) -mc version.c |
if exist svarlngc.lib del svarlngc.lib |
wlib -n svarlngc.lib +autoload.obj +svarlang.obj |
wlib -n svarlngc.lib +autoload.obj +svarlang.obj +version.obj |
svarlngm.lib: autoload.c svarlang.c |
svarlngm.lib: autoload.c svarlang.c version.c |
wcc $(CFLAGS) -mm autoload.c |
wcc $(CFLAGS) -mm svarlang.c |
wcc $(CFLAGS) -mm version.c |
if exist svarlngm.lib del svarlngm.lib |
wlib -n svarlngm.lib +autoload.obj +svarlang.obj |
wlib -n svarlngm.lib +autoload.obj +svarlang.obj +version.obj |
svarlngl.lib: autoload.c svarlang.c |
svarlngl.lib: autoload.c svarlang.c version.c |
wcc $(CFLAGS) -ml autoload.c |
wcc $(CFLAGS) -ml svarlang.c |
wcc $(CFLAGS) -ml version.c |
if exist svarlngl.lib del svarlngl.lib |
wlib -n svarlngl.lib +autoload.obj +svarlang.obj |
wlib -n svarlngl.lib +autoload.obj +svarlang.obj +version.obj |
tlumacz.exe: tlumacz.c |
//svarlang.lib/trunk/svarlang.h |
---|
1,7 → 1,7 |
/* This file is part of the svarlang project and is published under the terms |
* of the MIT license. |
* |
* Copyright (C) 2021-2022 Mateusz Viste |
* Copyright (C) 2021-2023 Mateusz Viste |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
25,6 → 25,13 |
#ifndef SVARLANG_H |
#define SVARLANG_H |
/* library version */ |
#define SVARLANGVER "20230628" |
/* returns a pointer to a string with the SvarLANG's library version, |
* independently of the SVARLANGVER string above. */ |
const char *svarlang_getver(void); |
/* loads translations for program progname, language lang, in paths. |
* |
* only the two first letters of the lang strings are meaningful and they are |
42,10 → 49,12 |
* done yet. */ |
int svarlang_load(const char *progname, const char *lang, const char *paths); |
/* same as svarlang_load(), but relies on getenv() to pull LANG and NLSPATH. |
* this call should be used only by "CORE" SvarDOS programs. */ |
int svarlang_autoload(const char *progname); |
/* Returns a pointer to the string "id". Does not require svalang_load() to be |
* executed, but then it will only return the reference language strings. |
* a string id is the concatenation of the CATS-style identifiers, for example |
53,8 → 62,10 |
* It NEVER returns NULL, if id not found then an empty string is returned */ |
const char *svarlang_strid(unsigned short id); |
/* a convenience definition to fetch strings by their CATS-style pairs instead |
* of the 16-bit id. */ |
#define svarlang_str(x, y) svarlang_strid((x << 8) | y) |
#endif |
//svarlang.lib/trunk/tlumacz.c |
---|
1,5 → 1,5 |
/* |
* Copyright (C) 2021-2022 Mateusz Viste |
* Copyright (C) 2021-2023 Mateusz Viste |
* |
* usage: tlumacz en fr pl etc |
* |
28,6 → 28,7 |
#include <stdlib.h> |
#include <string.h> |
#include "version.h" |
struct bitmap { |
238,7 → 239,11 |
unsigned short biggest_langsz = 0; |
if (argc < 2) { |
puts("usage: tlumacz en fr pl etc"); |
puts("tlumacz ver " SVARLANGVER " - this tool is part of the SvarLANG project."); |
puts("converts a set of CATS-style translations in files EN.TXT, PL.TXT, etc"); |
puts("into a single resource file (OUT.LNG)."); |
puts(""); |
puts("usage: tlumacz en fr pl ..."); |
return(1); |
} |
309,7 → 314,7 |
ecode = 1; |
} else { |
unsigned short allocsz = biggest_langsz + (biggest_langsz / 20); |
printf("biggest lang block is %u bytes -> allocating a %u bytes buffer\n", biggest_langsz, allocsz); |
printf("biggest lang block is %u bytes -> allocating a %u bytes buffe (5%% safety margin)r\n", biggest_langsz, allocsz); |
fprintf(fd, "/* THIS FILE HAS BEEN GENERATED BY TLUMACZ (PART OF THE SVARLANG LIBRARY) */\r\n"); |
fprintf(fd, "const unsigned short svarlang_memsz = %uu;\r\n", allocsz); |
fprintf(fd, "char svarlang_mem[%u] = {\r\n", allocsz); |
//svarlang.lib/trunk/version.c |
---|
0,0 → 1,29 |
/* This file is part of the svarlang project and is published under the terms |
* of the MIT license. |
* |
* Copyright (C) 2021-2022 Mateusz Viste |
* |
* Permission is hereby granted, free of charge, to any person obtaining a |
* copy of this software and associated documentation files (the "Software"), |
* to deal in the Software without restriction, including without limitation |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
* and/or sell copies of the Software, and to permit persons to whom the |
* Software is furnished to do so, subject to the following conditions: |
* |
* The above copyright notice and this permission notice shall be included in |
* all copies or substantial portions of the Software. |
* |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
* DEALINGS IN THE SOFTWARE. |
*/ |
#include "svarlang.h" |
const char *svarlang_getver(void) { |
return SVARLANGVER; |
} |