Skip to content

Commit 8fe2a2e

Browse files
committed
support loading data separator from country.sys also, default is hardcoded comma (,)
1 parent f1b59fc commit 8fe2a2e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

hdr/nls.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ struct CountrySpecificInfo {
356356
*/
357357
char CurrencyPrecision; /* = 2 # Currency precision */
358358
char TimeFormat; /* = 0 # time format: 0/1: 12/24 houres */
359+
void FAR *CharMapFn; /* far pointer to user callable character mapping function */
360+
char DataSeparator[2]; /* ',' ASCIIZ value */
361+
/* 5 words reserved, should be 0 */
359362
};
360363

361364
/*

kernel/config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,7 @@ STATIC BOOL LoadCountryInfo(char *filenam, UWORD ctryCode, UWORD codePage)
15671567
char *filename = filenam == NULL ? "\\COUNTRY.SYS" : filenam;
15681568
BOOL rc = FALSE;
15691569
BYTE FAR *ptable;
1570+
void FAR *CharMapFn;
15701571

15711572
if ((fd = open(filename, 0)) < 0)
15721573
{
@@ -1629,6 +1630,7 @@ err:printf("%s has invalid format\n", filename);
16291630
nlsPackageHardcoded.cp = entry.codepage;
16301631
subf_data.length = /* MS-DOS "CTYINFO" is up to 38 bytes */
16311632
min(subf_data.length, sizeof(struct CountrySpecificInfo));
1633+
CharMapFn = ((struct CountrySpecificInfo *)ptable)->CharMapFn;
16321634
}
16331635
if (hdr[i].id == 1)
16341636
ptable = (BYTE FAR *)&nlsPackageHardcoded.nlsExt.size;
@@ -1660,6 +1662,10 @@ err:printf("%s has invalid format\n", filename);
16601662
} else {
16611663
fmemcpy(ptable + 2, subf_data.buffer,
16621664
/* skip length ^*/ subf_data.length);
1665+
if (hdr[i].id == 1) {
1666+
/* fixup user callable address in case we overwrote it */
1667+
((struct CountrySpecificInfo *)ptable)->CharMapFn = CharMapFn;
1668+
}
16631669
}
16641670
}
16651671
rc = TRUE;

0 commit comments

Comments
 (0)