Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 602 → Rev 603

/localcfg/trunk/Makefile
4,10 → 4,18
 
all: localcfg.com
 
localcfg.com: localcfg.c country.c
wcl -0 -y -cc -wx -mt -lr -zp1 -we -d0 -ox localcfg.c country.c
localcfg.com: localcfg.c country.c deflang.c
wcl -0 -y -cc -wx -mt -lr -zp1 -we -d0 -ox localcfg.c country.c deflang.c svarlang.lib/svarlngs.lib
upx --8086 -9 localcfg.com
 
deflang.c: nls_lang\*.txt
cd nls_lang
utf8tocp maz pl_utf8.txt > pl.txt
..\svarlang.lib\tlumacz en pl
move out.lng ..\localcfg.lng
move deflang.c ..\
cd ..
 
clean: .SYMBOLIC
del *.obj
del *.com
16,18 → 24,23
mkdir appinfo
mkdir source
mkdir source\localcfg
mkdir source\localcfg\nls_lang
mkdir bin
mkdir doc
mkdir nls
copy localcfg.lsm appinfo
copy localcfg.com bin
copy localcfg.lng nls
copy *.txt doc
copy *.c source\localcfg
copy *.h source\localcfg
copy *.txt source\localcfg
copy makefile source\localcfg
zip -9rkDX -m localcfg.zip appinfo bin doc source
copy nls_lang\*.* source\localcfg\nls_lang
zip -9rkDX -m localcfg.zip appinfo bin doc nls source
rmdir appinfo
rmdir source\localcfg
rmdir source
rmdir bin
rmdir doc
rmdir nls
/localcfg/trunk/localcfg.c
28,40 → 28,98
#include <stdlib.h> /* atoi() */
#include <string.h> /* strchr */
 
#include "svarlang.lib/svarlang.h"
 
#include "country.h"
 
#define PVER "20220202"
#define PVER "20220203"
#define PDATE "2015-2022"
 
 
enum NLS_STRINGS {
NLS_HLP_VER = 0x0000,
NLS_HLP_DESC = 0x0001,
NLS_HLP_USAGE = 0x0002,
NLS_HLP_OPTIONS = 0x0003,
NLS_HLP_COUNTRY = 0x000A,
NLS_HLP_CP = 0x000B,
NLS_HLP_DECIM = 0x000C,
NLS_HLP_THOUS = 0x000D,
NLS_HLP_DATESEP = 0x000E,
NLS_HLP_DATEFMT = 0x000F,
NLS_HLP_TIMESEP = 0x0010,
NLS_HLP_TIMEFMT = 0x0011,
NLS_HLP_CURR = 0x0012,
NLS_HLP_CURRPOS0 = 0x0013,
NLS_HLP_CURRPOS1 = 0x0014,
NLS_HLP_CURRPOS2 = 0x0015,
NLS_HLP_CURRSPC = 0x0016,
NLS_HLP_CURRPREC = 0x0017,
NLS_HLP_YESNO = 0x0018,
NLS_HLP_INFOLOC1 = 0x0032,
NLS_HLP_INFOLOC2 = 0x0033,
 
NLS_INFO_COUNTRY = 0x0700,
NLS_INFO_CODEPAGE = 0x0701,
NLS_INFO_DECSEP = 0x0702,
NLS_INFO_THOUSEP = 0x0703,
NLS_INFO_DATEFMT = 0x0704,
NLS_INFO_TIMEFMT = 0x0705,
NLS_INFO_YESNO = 0x0706,
NLS_INFO_CURREXAMPLE = 0x0707,
NLS_MAKESURE = 0x0709,
 
NLS_ERR_FILEPATHTWICE = 0x0900,
NLS_ERR_BADPATH = 0x0901,
NLS_ERR_READFAIL = 0x0902,
NLS_ERR_INVPARAM = 0x0903
};
 
 
static void nls_puts(enum NLS_STRINGS id) {
puts(svarlang_strid(id));
}
 
 
static void nls_put(enum NLS_STRINGS id) {
printf("%s", svarlang_strid(id));
}
 
 
static void crlf(void) {
puts("");
}
 
 
static void about(void) {
puts("localcfg ver " PVER " - locales configuration for DOS\n"
"Copyright (C) " PDATE " Mateusz Viste\n"
"\n"
"localcfg creates or edits a custom COUNTRY.SYS-like file with your preferences.\n"
"\n"
"usage: localcfg [COUNTRY.SYS] [options]\n"
"\n"
"options allow to configure country locales to your likening, as follows:\n"
" /country:XX indicates your country code is XX (1 for USA, 33 for France, etc)\n"
" /cp:XXX adapts country data for codepage XXX (example: '437')\n"
" /decim:X reconfigures the decimal symbol to be 'X'");
puts(" /thous:X reconfigures the thousands symbol to be 'X'\n"
" /datesep:X sets the date separator to 'X' (for example '/')\n"
" /datefmt:X sets the date format, can be: MDY, DMY or YMD\n"
" /timesep:X sets the time separator to 'X' (for example ':')\n"
" /timefmt:X sets the time format: 0=12h with AM/PM or 1=24h\n"
" /curr:XXX sets the currency to XXX (a string of 1 to 4 characters)\n"
" /currpos:X sets the currency symbol position to X, where X is either");
puts(" 0=currency precedes the value, 1=currency follows the value and\n"
" 2=currency replaces the decimal sign\n"
" /currspc:X space between the currency and the value (0=no, 1=yes)\n"
" /currprec:X currency's precision (number of decimal digits, 0..9)\n"
" /yesno:XY sets the 'Yes/No' letter to XY (default: YN)\n"
"\n"
"If COUNTRY.SYS location is not provided, then localcfg tries loading it\n"
"from %DOSDIR%\\CFG\\COUNTRY.SYS\n"
);
printf("localcfg ");
nls_put(NLS_HLP_VER);
puts(" " PVER ", (C) " PDATE " Mateusz Viste");
crlf();
nls_puts(NLS_HLP_DESC);
crlf();
nls_puts(NLS_HLP_USAGE);
crlf();
nls_puts(NLS_HLP_OPTIONS);
crlf();
nls_puts(NLS_HLP_COUNTRY);
nls_puts(NLS_HLP_CP);
nls_puts(NLS_HLP_DECIM);
nls_puts(NLS_HLP_THOUS);
nls_puts(NLS_HLP_DATESEP);
nls_puts(NLS_HLP_DATEFMT);
nls_puts(NLS_HLP_TIMESEP);
nls_puts(NLS_HLP_TIMEFMT);
nls_puts(NLS_HLP_CURR);
nls_puts(NLS_HLP_CURRPOS0);
nls_puts(NLS_HLP_CURRPOS1);
nls_puts(NLS_HLP_CURRPOS2);
nls_puts(NLS_HLP_CURRSPC);
nls_puts(NLS_HLP_CURRPREC);
nls_puts(NLS_HLP_YESNO);
crlf();
nls_puts(NLS_HLP_INFOLOC1);
nls_puts(NLS_HLP_INFOLOC2);
}
 
 
303,16 → 361,18
int x;
static char fname[130];
 
svarlang_autoload("localcfg");
 
/* scan argv looking for the path to country.sys */
for (x = 1; x < argc; x++) {
if (argv[x][0] != '/') {
if (fname[0] != 0) {
puts("ERROR: file path can be provided only once");
nls_puts(NLS_ERR_FILEPATHTWICE);
return(1);
}
/* */
if (file_truename(fname, argv[x]) != 0) {
puts("ERROR: bad file path");
nls_puts(NLS_ERR_BADPATH);
return(1);
}
} else if (strcmp(argv[x], "/?") == 0) { /* is it /? */
326,7 → 386,7
 
x = country_read(&cntdata, fname);
if (x != 0) {
printf("ERROR: failed to read the preference file [%d]\n", x);
nls_puts(NLS_ERR_READFAIL);
return(2);
}
 
337,23 → 397,32
if (argv[x][0] != '/') continue; /* skip country.sys filename (processed earlier) */
changedflag++;
if (processarg(argv[x], &cntdata) != 0) {
puts("ERROR: invalid parameter syntax");
nls_puts(NLS_ERR_INVPARAM);
return(3);
}
}
 
printf("Country intl code.....: %03d\n", cntdata.CTYINFO.id);
printf("Codepage..............: %d\n", cntdata.CTYINFO.codepage);
printf("Decimal separator.....: %c\n", cntdata.CTYINFO.decimal[0]);
printf("Thousands separator...: %c\n", cntdata.CTYINFO.thousands[0]);
printf("Date format...........: %s\n", datestring(&cntdata));
printf("Time format...........: %s\n", timestring(&cntdata));
printf("Yes/No letters........: %c/%c\n", cntdata.YESNO.yes[0], cntdata.YESNO.no[0]);
printf("Currency example......: %s\n", currencystring(&cntdata));
nls_put(NLS_INFO_COUNTRY);
printf(" %03d\r\n", cntdata.CTYINFO.id);
nls_put(NLS_INFO_CODEPAGE);
printf(" %d\r\n", cntdata.CTYINFO.codepage);
nls_put(NLS_INFO_DECSEP);
printf(" %c\r\n", cntdata.CTYINFO.decimal[0]);
nls_put(NLS_INFO_THOUSEP);
printf(" %c\r\n", cntdata.CTYINFO.thousands[0]);
nls_put(NLS_INFO_DATEFMT);
printf(" %s\r\n", datestring(&cntdata));
nls_put(NLS_INFO_TIMEFMT);
printf(" %s\r\n", timestring(&cntdata));
nls_put(NLS_INFO_YESNO);
printf(" %c/%c\r\n", cntdata.YESNO.yes[0], cntdata.YESNO.no[0]);
nls_put(NLS_INFO_CURREXAMPLE);
printf(" %s\r\n", currencystring(&cntdata));
 
printf("\n"
"Make sure that your CONFIG.SYS contains this directive:\n"
"COUNTRY=%03d,%03d,%s\n\n", cntdata.CTYINFO.id, cntdata.CTYINFO.codepage, fname);
crlf();
nls_puts(NLS_MAKESURE);
printf("COUNTRY=%03d,%03d,%s", cntdata.CTYINFO.id, cntdata.CTYINFO.codepage, fname);
crlf();
 
/* if anything changed, write the new file */
if (changedflag != 0) country_write(fname, &cntdata);
/localcfg/trunk/nls_lang/en.txt
0,0 → 1,53
#
# LOCALCFG TRANSLATION FILE
#
# LANGUAGE: ENGLISH
# TRANSLATOR: MATEUSZ VISTE
#
 
### HELP SCREEN ###########################################################
 
0.0:version
0.1:creates or edits COUNTRY.SYS local preferences
0.2:usage: localcfg [COUNTRY.SYS] [options]
0.3:options:
 
0.10:/country:XX set the country code to XX (1=USA, 33=France, 48=Poland, etc)
0.11:/cp:XXX adapts country data for codepage XXX (example: '437')
0.12:/decim:X reconfigures the decimal symbol to be 'X'
0.13:/thous:X reconfigures the thousands symbol to be 'X'
0.14:/datesep:X sets the date separator to 'X' (for example '/')
0.15:/datefmt:X sets the date format, can be: MDY, DMY or YMD
0.16:/timesep:X sets the time separator to 'X' (for example ':')
0.17:/timefmt:X sets the time format: 0=12h with AM/PM or 1=24h
0.18:/curr:XXX sets the currency to XXX (a string of 1 to 4 characters)
0.19:/currpos:X sets the currency symbol position to X, where X is either
0.20: 0=currency precedes the value, 1=currency follows the value and
0.21: 2=currency replaces the decimal sign
0.22:/currspc:X space between the currency and the value (0=no, 1=yes)
0.23:/currprec:X currency's precision (number of decimal digits, 0..9)
0.24:/yesno:XY sets the 'Yes/No' letter to XY (default: YN)
 
0.50:If COUNTRY.SYS location is not provided, then localcfg tries loading it
0.51:from %DOSDIR%\CFG\COUNTRY.SYS
 
 
### INFO SCREEN ###########################################################
 
7.0:Country code.......:
7.1:Codepage...........:
7.2:Decimal separator..:
7.3:Thousands separator:
7.4:Date format........:
7.5:Time format........:
7.6:Yes/No characters..:
7.7:Currency example...:
 
7.9:Make sure that your CONFIG.SYS contains this directive:
 
### ERROR MESSAGES ########################################################
 
9.0:ERROR: file path can be provided only once.
9.1:ERROR: bad path to file
9.2:ERROR: failed to read the file
9.3:ERROR: invalid parameter syntax
/localcfg/trunk/nls_lang/pl_utf8.txt
0,0 → 1,53
#
# LOCALCFG TRANSLATION FILE
#
# LANGUAGE: POLISH
# TRANSLATOR: MATEUSZ VISTE
#
 
### HELP SCREEN ###########################################################
 
0.0:wersja
0.1:tworzy lub zmienia lokalne preferencje COUNTRY.SYS
0.2:użycie: localcfg [COUNTRY.SYS] [opcje]
0.3:opcje
 
0.10:/country:XX ustawia kod kraju na XX (1=USA, 33=Francja, 48=Polska, itd)
0.11:/cp:XXX adapts country data for codepage XXX (przykład: '437')
0.12:/decim:X ustawia separator dziesiętny 'X'
0.13:/thous:X ustawia separator tysięczny 'X'
0.14:/datesep:X ustawia separator daty 'X' (np. '/')
0.15:/datefmt:X ustawia jeden z formatów daty: MDY, DMY lub YMD
0.16:/timesep:X ustawia separator czasu 'X' (np. ':')
0.17:/timefmt:X ustawia format godziny: 0=12h z AM/PM lub 1=24h
0.18:/curr:XXX ustawia walutę XXX (ciąg od 1 do 4 znaków)
0.19:/currpos:X ustawia miejsce symbolu walutowego, gdzie X może być:
0.20: 0=symbol waluty przed sumą, 1=symbol waluty po sumie,
0.21: 2=symbol waluty zastępuje znak dziesiętny
0.22:/currspc:X spacja pomiędzy walutą a wartością (0=nie, 1=tak)
0.23:/currprec:X dokładność waluty (liczba pozycji dziesiętnych, 0..9)
0.24:/yesno:XY ustawia znaki 'Tak/Nie' (domyślnie: YN)
 
0.50:Jeśli nie podasz ścieżki do COUNTRY.SYS to localcfg spróbuje załadować plik
0.51:%DOSDIR%\CFG\COUNTRY.SYS
 
 
### INFO SCREEN ###########################################################
 
7.0:Kod kraju..........:
7.1:Strona kodowa......:
7.2:Znak dziesiętny....:
7.3:Separator tysięczny:
7.4:Format daty........:
7.5:Format godziny.....:
7.6:Znaki Tak/Nie......:
7.7:Przykład waluty....:
 
7.9:Upewnij się, że twój plik CONFIG.SYS zawiera taki wpis:
 
### ERROR MESSAGES ########################################################
 
9.0:BŁĄD: ścieżka do pliku może zostać podana tylko raz.
9.1:BŁĄD: zła ścieżka do pliku.
9.2:BŁĄD: nie zdołano wczytać pliku.
9.3:BŁĄD: nieprawidłowa składnia parametru.