mirror of
https://github.com/FDOS/kernel.git
synced 2025-04-08 17:15:17 +02:00
Ported COUNTRY.SYS support from the unstable branch.
Simple country support is kept: COUNTRY=31 will look for country.sys but if it does not exist, not complain and load the built-in info. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1430 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
e0ca8d76e2
commit
054631c300
26
hdr/nls.h
26
hdr/nls.h
@ -269,6 +269,8 @@
|
||||
* information itself; it is ignored when the user calls DOS-65-0x
|
||||
* to return such pointer.
|
||||
* NLS_REORDER_POINTERS is *enabled* by default.
|
||||
* UPDATE: With NLS_REORDER_POINTERS, now table 7 (DBCS) is also
|
||||
* expected to be located at a predictable index. -- eca
|
||||
*/
|
||||
|
||||
/* Define if some user program possibly modifies the value of the internal
|
||||
@ -289,7 +291,7 @@
|
||||
/* What version of nlsInfo and accompanying associations
|
||||
Must be passed to NLSFUNC upon MUX-14-00 to identify the
|
||||
correct kernel to the tools. */
|
||||
#define NLS_FREEDOS_NLSFUNC_VERSION 0xFD01
|
||||
#define NLS_FREEDOS_NLSFUNC_VERSION 0xFD02
|
||||
/* Represents a call to DOS-38 within DOS-65 handlers.
|
||||
Current implementation relys on 0x101! */
|
||||
#define NLS_DOS_38 0x101
|
||||
@ -425,8 +427,8 @@ struct nlsPackage { /* the contents of one chain item of the
|
||||
MUX-14 processor does not require them and performs
|
||||
all actions itself, so that the kernel never tries to
|
||||
fetch this information itself. */
|
||||
UBYTE yeschar; /* yes / no character DOS-65-23 */
|
||||
UBYTE nochar;
|
||||
UWORD yeschar; /* yes / no character DOS-65-23 */
|
||||
UWORD nochar;
|
||||
unsigned numSubfct; /* number of supported sub-functions */
|
||||
struct nlsPointer nlsPointers[1]; /* grows dynamically */
|
||||
};
|
||||
@ -474,14 +476,14 @@ struct nlsInfoBlock { /* This block contains all information
|
||||
};
|
||||
|
||||
extern struct nlsInfoBlock ASM nlsInfo;
|
||||
extern struct nlsPackage ASM nlsPackageHardcoded;
|
||||
extern struct nlsPackage FAR ASM nlsPackageHardcoded;
|
||||
/* These are the "must have" tables within the hard coded NLS pkg */
|
||||
extern struct nlsFnamTerm nlsFnameTermHardcoded;
|
||||
extern struct nlsDBCS ASM nlsDBCSHardcoded;
|
||||
extern struct nlsCharTbl nlsUpcaseHardcoded;
|
||||
extern struct nlsCharTbl nlsFUpcaseHardcoded;
|
||||
extern struct nlsCharTbl nlsCollHardcoded;
|
||||
extern struct nlsExtCntryInfo nlsCntryInfoHardcoded;
|
||||
extern struct nlsFnamTerm FAR ASM nlsFnameTermHardcoded;
|
||||
extern struct nlsDBCS FAR ASM nlsDBCSHardcoded;
|
||||
extern struct nlsCharTbl FAR ASM nlsUpcaseHardcoded;
|
||||
extern struct nlsCharTbl FAR ASM nlsFUpcaseHardcoded;
|
||||
extern struct nlsCharTbl FAR ASM nlsCollHardcoded;
|
||||
extern struct nlsExtCntryInfo FAR ASM nlsCntryInfoHardcoded;
|
||||
extern BYTE FAR hcTablesStart[], hcTablesEnd[];
|
||||
|
||||
/***********************************************************************
|
||||
@ -570,8 +572,8 @@ struct csys_ccDefinition { /* country/codepage reference */
|
||||
UWORD cntry, cp; is missing
|
||||
int flags; is NLS_FLAG_HARDCODED, if the
|
||||
kernel is to handle the data of its own
|
||||
UBYTE yeschar; is filled
|
||||
UBYTE nochar; is filled
|
||||
UWORD yeschar; is filled
|
||||
UWORD nochar; is filled
|
||||
unsigned numSubfct; is filled
|
||||
struct nlsPointer nlsPointers[1]; is filled
|
||||
the pointer member is the absolute
|
||||
|
137
kernel/config.c
137
kernel/config.c
@ -229,7 +229,7 @@ STATIC int SkipLine(char *pLine);
|
||||
STATIC char * stristr(char *s1, char *s2);
|
||||
#endif
|
||||
STATIC char strcaseequal(const char * d, const char * s);
|
||||
STATIC int LoadCountryInfoHardCoded(char *filename, COUNT ctryCode, COUNT codePage);
|
||||
STATIC int LoadCountryInfoHardCoded(COUNT ctryCode);
|
||||
STATIC void umb_init(void);
|
||||
|
||||
void HMAconfig(int finalize);
|
||||
@ -1216,34 +1216,130 @@ STATIC VOID CfgKeyBuf(BYTE * pLine)
|
||||
*
|
||||
* Returns TRUE if successful, FALSE if not.
|
||||
*/
|
||||
#if 0
|
||||
STATIC BOOL LoadCountryInfo(char *filename, UWORD ctryCode, UWORD codePage)
|
||||
STATIC BOOL LoadCountryInfo(char *filenam, UWORD ctryCode, UWORD codePage)
|
||||
{
|
||||
printf("Sorry, the COUNTRY= statement has been temporarily disabled\n");
|
||||
/* COUNTRY.SYS file data structures - see RBIL tables 2619-2622 */
|
||||
|
||||
UNREFERENCED_PARAMETER(codePage);
|
||||
UNREFERENCED_PARAMETER(ctryCode);
|
||||
UNREFERENCED_PARAMETER(filename);
|
||||
struct { /* file header */
|
||||
char name[8]; /* "\377COUNTRY.SYS" */
|
||||
char reserved[11];
|
||||
ULONG offset; /* offset of first entry in file */
|
||||
} header;
|
||||
struct { /* entry */
|
||||
int length; /* length of entry, not counting this word, = 12 */
|
||||
int country; /* country ID */
|
||||
int codepage; /* codepage ID */
|
||||
int reserved[2];
|
||||
ULONG offset; /* offset of country-subfunction-header in file */
|
||||
} entry;
|
||||
struct subf_hdr { /* subfunction header */
|
||||
int length; /* length of entry, not counting this word, = 6 */
|
||||
int id; /* subfunction ID */
|
||||
ULONG offset; /* offset within file of subfunction data entry */
|
||||
};
|
||||
static struct { /* subfunction data */
|
||||
char signature[8]; /* \377CTYINFO|UCASE|LCASE|FUCASE|FCHAR|COLLATE|DBCS */
|
||||
int length; /* length of following table in bytes */
|
||||
UBYTE buffer[256];
|
||||
} subf_data;
|
||||
struct subf_tbl {
|
||||
char sig[8]; /* signature for each subfunction data */
|
||||
void FAR *p; /* pointer to data in nls_hc.asm to be copied to */
|
||||
};
|
||||
static struct subf_tbl table[8] = {
|
||||
{"\377 ", NULL}, /* 0, unused */
|
||||
{"\377CTYINFO", &nlsCntryInfoHardcoded},/* 1 */
|
||||
{"\377UCASE ", &nlsUpcaseHardcoded}, /* 2 */
|
||||
{"\377LCASE ", NULL}, /* 3, not supported [yet] */
|
||||
{"\377FUCASE ", &nlsFUpcaseHardcoded}, /* 4 */
|
||||
{"\377FCHAR ", &nlsFnameTermHardcoded},/* 5 */
|
||||
{"\377COLLATE", &nlsCollHardcoded}, /* 6 */
|
||||
{"\377DBCS ", &nlsDBCSHardcoded} /* 7, not supported [yet] */
|
||||
};
|
||||
static struct subf_hdr hdr[8];
|
||||
int fd, entries, count, i;
|
||||
char *filename = filenam == NULL ? "\\COUNTRY.SYS" : filenam;
|
||||
BOOL rc = FALSE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
if ((fd = open(filename, 0)) < 0)
|
||||
{
|
||||
if (filenam == NULL)
|
||||
return !LoadCountryInfoHardCoded(ctryCode);
|
||||
printf("%s not found\n", filename);
|
||||
return rc;
|
||||
}
|
||||
if (read(fd, &header, sizeof(header)) != sizeof(header))
|
||||
{
|
||||
printf("Error reading %s\n", filename);
|
||||
goto ret;
|
||||
}
|
||||
if (memcmp(header.name, "\377COUNTRY", sizeof(header.name)))
|
||||
{
|
||||
err:printf("%s has invalid format\n", filename);
|
||||
goto ret;
|
||||
}
|
||||
if (lseek(fd, header.offset) == 0xffffffffL
|
||||
|| read(fd, &entries, sizeof(entries)) != sizeof(entries))
|
||||
goto err;
|
||||
for (i = 0; i < entries; i++)
|
||||
{
|
||||
if (read(fd, &entry, sizeof(entry)) != sizeof(entry) || entry.length != 12)
|
||||
goto err;
|
||||
if (entry.country != ctryCode || entry.codepage != codePage && codePage)
|
||||
continue;
|
||||
if (lseek(fd, entry.offset) == 0xffffffffL
|
||||
|| read(fd, &count, sizeof(count)) != sizeof(count)
|
||||
|| count > LENGTH(hdr)
|
||||
|| read(fd, &hdr, sizeof(struct subf_hdr) * count)
|
||||
!= sizeof(struct subf_hdr) * count)
|
||||
goto err;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (hdr[i].length != 6)
|
||||
goto err;
|
||||
if (hdr[i].id < 1 || hdr[i].id > 6 || hdr[i].id == 3)
|
||||
continue;
|
||||
if (lseek(fd, hdr[i].offset) == 0xffffffffL
|
||||
|| read(fd, &subf_data, 10) != 10
|
||||
|| memcmp(subf_data.signature, table[hdr[i].id].sig, 8) && (hdr[i].id !=4
|
||||
|| memcmp(subf_data.signature, table[2].sig, 8)) /* UCASE for FUCASE ^*/
|
||||
|| read(fd, subf_data.buffer, subf_data.length) != subf_data.length)
|
||||
goto err;
|
||||
if (hdr[i].id == 1)
|
||||
{
|
||||
if (((struct CountrySpecificInfo *)subf_data.buffer)->CountryID
|
||||
!= entry.country
|
||||
|| ((struct CountrySpecificInfo *)subf_data.buffer)->CodePage
|
||||
!= entry.codepage
|
||||
&& codePage)
|
||||
continue;
|
||||
nlsPackageHardcoded.cntry = entry.country;
|
||||
nlsPackageHardcoded.cp = entry.codepage;
|
||||
subf_data.length = /* MS-DOS "CTYINFO" is up to 38 bytes */
|
||||
min(subf_data.length, sizeof(struct CountrySpecificInfo));
|
||||
}
|
||||
fmemcpy((BYTE FAR *)(table[hdr[i].id].p) + 2, subf_data.buffer,
|
||||
/* skip length ^*/ subf_data.length);
|
||||
}
|
||||
rc = TRUE;
|
||||
goto ret;
|
||||
}
|
||||
printf("couldn't find info for country ID %u\n", ctryCode);
|
||||
ret:
|
||||
close(fd);
|
||||
return rc;
|
||||
}
|
||||
|
||||
STATIC VOID Country(BYTE * pLine)
|
||||
{
|
||||
/* Format: COUNTRY = countryCode, [codePage], filename */
|
||||
COUNT ctryCode;
|
||||
COUNT codePage = (COUNT)NLS_DEFAULT;
|
||||
char *filename = "";
|
||||
COUNT codePage = 0;
|
||||
char *filename = NULL;
|
||||
|
||||
if ((pLine = GetNumArg(pLine, &ctryCode)) == 0)
|
||||
goto error;
|
||||
|
||||
|
||||
/* currently 'implemented'
|
||||
COUNTRY=49 */
|
||||
|
||||
#if 0
|
||||
pLine = skipwh(pLine);
|
||||
if (*pLine == ',')
|
||||
{
|
||||
@ -1260,9 +1356,8 @@ STATIC VOID Country(BYTE * pLine)
|
||||
filename = szBuf;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!LoadCountryInfoHardCoded(filename, ctryCode, codePage))
|
||||
if (LoadCountryInfo(filename, ctryCode, codePage))
|
||||
return;
|
||||
|
||||
error:
|
||||
@ -2465,11 +2560,9 @@ struct CountrySpecificInfo specificCountriesSupported[] = {
|
||||
Aitor Santamara Merino (SP)
|
||||
*/
|
||||
|
||||
STATIC int LoadCountryInfoHardCoded(char *filename, COUNT ctryCode, COUNT codePage)
|
||||
STATIC int LoadCountryInfoHardCoded(COUNT ctryCode)
|
||||
{
|
||||
struct CountrySpecificInfo *country;
|
||||
UNREFERENCED_PARAMETER(codePage);
|
||||
UNREFERENCED_PARAMETER(filename);
|
||||
|
||||
/* printf("cntry: %u, CP%u, file=\"%s\"\n", ctryCode, codePage, filename); */
|
||||
|
||||
|
@ -172,6 +172,7 @@ unsigned ASMPASCAL read(int fd, void *buf, unsigned count);
|
||||
int ASMPASCAL open(const char *pathname, int flags);
|
||||
int ASMPASCAL close(int fd);
|
||||
int ASMPASCAL dup2(int oldfd, int newfd);
|
||||
ULONG ASMPASCAL lseek(int fd, long position);
|
||||
seg ASMPASCAL allocmem(UWORD size);
|
||||
void ASMPASCAL init_PSPSet(seg psp_seg);
|
||||
int ASMPASCAL init_DosExec(int mode, exec_blk * ep, char * lp);
|
||||
|
@ -1347,6 +1347,7 @@ dispatch:
|
||||
/* UNDOCUMENTED: Double byte and korean tables */
|
||||
case 0x63:
|
||||
{
|
||||
VOID FAR *p;
|
||||
#if 0
|
||||
/* not really supported, but will pass. */
|
||||
lr.AL = 0x00; /*jpp: according to interrupt list */
|
||||
@ -1356,8 +1357,9 @@ dispatch:
|
||||
switch (lr.AL)
|
||||
{
|
||||
case 0:
|
||||
lr.DS = FP_SEG(&nlsDBCSHardcoded);
|
||||
lr.SI = FP_OFF(&nlsDBCSHardcoded);
|
||||
p = DosGetDBCS();
|
||||
lr.DS = FP_SEG(p);
|
||||
lr.SI = FP_OFF(p);
|
||||
break;
|
||||
case 1: /* set Korean Hangul input method to DL 0/1 */
|
||||
lr.AL = 0xff; /* flag error (AL would be 0 if okay) */
|
||||
|
@ -233,6 +233,24 @@ DUP2:
|
||||
mov ah, 46h
|
||||
jmp short common_int21
|
||||
|
||||
;
|
||||
; ULONG ASMPASCAL lseek(int fd, long position);
|
||||
;
|
||||
global LSEEK
|
||||
LSEEK:
|
||||
pop ax ; ret address
|
||||
pop dx ; position low
|
||||
pop cx ; position high
|
||||
pop bx ; fd
|
||||
push ax ; ret address
|
||||
mov ax,4200h ; origin: start of file
|
||||
int 21h
|
||||
jnc seek_ret ; CF=1?
|
||||
sbb ax,ax ; then dx:ax = -1, else unchanged
|
||||
sbb dx,dx
|
||||
seek_ret:
|
||||
ret
|
||||
|
||||
;; VOID init_PSPSet(seg psp_seg)
|
||||
global INIT_PSPSET
|
||||
INIT_PSPSET:
|
||||
|
123
kernel/nls.c
123
kernel/nls.c
@ -75,9 +75,11 @@ struct nlsInfoBlock ASM nlsInfo = {
|
||||
#ifdef NLS_REORDER_POINTERS
|
||||
#define getTable2(nls) ((nls)->nlsPointers[0].pointer)
|
||||
#define getTable4(nls) ((nls)->nlsPointers[1].pointer)
|
||||
#define getTable7(nls) ((nls)->nlsPointers[4].pointer)
|
||||
#else
|
||||
#define getTable2(nls) getTable(2, (nls))
|
||||
#define getTable4(nls) getTable(4, (nls))
|
||||
#define getTable7(nls) getTable(7, (nls))
|
||||
#define NEED_GET_TABLE
|
||||
#endif
|
||||
/*== both chartables must be 128 bytes long and lower range is
|
||||
@ -108,7 +110,7 @@ STATIC long muxGo(int subfct, UWORD bp, UWORD cp, UWORD cntry, UWORD bufsize,
|
||||
/*
|
||||
* Call NLSFUNC to load the NLS package
|
||||
*/
|
||||
COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
||||
STATIC COUNT muxLoadPkg(int subfct, UWORD cp, UWORD cntry)
|
||||
{
|
||||
long ret;
|
||||
|
||||
@ -120,6 +122,11 @@ COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
||||
/* make sure the NLSFUNC ID is updated */
|
||||
#error "NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID"
|
||||
#endif
|
||||
/* Install check must pass the FreeDOS NLSFUNC version as codepage (cp) and
|
||||
the FreeDOS NLSFUNC ID as buffer size (bufsize). If they match the
|
||||
version in NLSFUNC, on return it will set BX (cp on entry) to FreeDOS
|
||||
NLSFUNC ID. call_nls will set the high word = BX on return.
|
||||
*/
|
||||
ret = muxGo(0, 0, NLS_FREEDOS_NLSFUNC_VERSION, 0, NLS_FREEDOS_NLSFUNC_ID, 0);
|
||||
if ((int)ret != 0x14ff)
|
||||
return DE_FILENOTFND; /* No NLSFUNC --> no load */
|
||||
@ -129,7 +136,7 @@ COUNT muxLoadPkg(UWORD cp, UWORD cntry)
|
||||
/* OK, the correct NLSFUNC is available --> load pkg */
|
||||
/* If cp == -1 on entry, NLSFUNC updates cp to the codepage loaded
|
||||
into memory. The system must then change to this one later */
|
||||
return (int)muxGo(NLSFUNC_LOAD_PKG, 0, cp, cntry, 0, 0);
|
||||
return (int)muxGo(subfct, 0, cp, cntry, 0, 0);
|
||||
}
|
||||
|
||||
STATIC int muxBufGo(int subfct, int bp, UWORD cp, UWORD cntry,
|
||||
@ -205,12 +212,15 @@ STATIC VOID FAR *getTable(UBYTE subfct, struct nlsPackage FAR * nls)
|
||||
switch (subfct)
|
||||
{
|
||||
case 2:
|
||||
return &nlsUpHardcodedTable;
|
||||
return &nlsUpcaseHardcoded;
|
||||
case 4:
|
||||
return &nlsFnameUpHardcodedTable;
|
||||
return &nlsFUpcaseHardcoded;
|
||||
/* case 5: return &nlsFnameTermHardcodedTable; */
|
||||
/* case 6: return &nlsCollHardcodedTable; */
|
||||
case 7:
|
||||
return &nlsDBCSHardcoded;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -365,6 +375,9 @@ STATIC COUNT nlsSetPackage(struct nlsPackage FAR * nls)
|
||||
}
|
||||
STATIC COUNT DosSetPackage(UWORD cp, UWORD cntry)
|
||||
{
|
||||
/* Right now, we do not have codepage change support in kernel, so push
|
||||
it through the mux in any case. */
|
||||
#if 0
|
||||
struct nlsPackage FAR *nls; /* NLS package to use to return the info from */
|
||||
|
||||
/* nls := NLS package of cntry/codepage */
|
||||
@ -373,7 +386,28 @@ STATIC COUNT DosSetPackage(UWORD cp, UWORD cntry)
|
||||
return nlsSetPackage(nls);
|
||||
|
||||
/* not loaded --> invoke NLSFUNC to load it */
|
||||
return muxLoadPkg(cp, cntry);
|
||||
#endif
|
||||
return muxLoadPkg(NLSFUNC_LOAD_PKG2, cp, cntry);
|
||||
}
|
||||
|
||||
STATIC COUNT nlsLoadPackage(struct nlsPackage FAR * nls)
|
||||
{
|
||||
|
||||
nlsInfo.actPkg = nls;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
STATIC COUNT DosLoadPackage(UWORD cp, UWORD cntry)
|
||||
{
|
||||
struct nlsPackage FAR *nls; /* NLS package to use to return the info from */
|
||||
|
||||
/* nls := NLS package of cntry/codepage */
|
||||
if ((nls = searchPackage(cp, cntry)) != NULL)
|
||||
/* OK the NLS pkg is loaded --> activate it */
|
||||
return nlsLoadPackage(nls);
|
||||
|
||||
/* not loaded --> invoke NLSFUNC to load it */
|
||||
return muxLoadPkg(NLSFUNC_LOAD_PKG, cp, cntry);
|
||||
}
|
||||
|
||||
STATIC void nlsUpMem(struct nlsPackage FAR * nls, VOID FAR * str, int len)
|
||||
@ -399,18 +433,41 @@ STATIC VOID xUpMem(struct nlsPackage FAR * nls, VOID FAR * str,
|
||||
muxBufGo(NLSFUNC_UPMEM, 0, nls->cp, nls->cntry, len, str);
|
||||
}
|
||||
|
||||
STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch)
|
||||
STATIC BOOL nlsIsDBCS(UBYTE ch)
|
||||
{
|
||||
log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? ch : ' '));
|
||||
|
||||
xUpMem(nls, MK_FP(_SS, &ch), 1); /* Upcase character */
|
||||
/* Cannot use DosUpChar(), because
|
||||
maybe: nls != current NLS pkg
|
||||
However: Upcase character within lowlevel
|
||||
function to allow a yesNo() function
|
||||
catched by external MUX-14 handler, which
|
||||
does NOT upcase character. */
|
||||
log(("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch > 32 ? ch : ' '));
|
||||
if (ch < 128)
|
||||
return FALSE; /* No leadbyte is smaller than that */
|
||||
|
||||
{
|
||||
UWORD FAR *t= ((struct nlsDBCS FAR*)getTable7(nlsInfo.actPkg))->dbcsTbl;
|
||||
|
||||
for (; *t != 0; ++t)
|
||||
if (ch >= (*t & 0xFF) && ch <= (*t >> 8))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
STATIC int nlsYesNo(struct nlsPackage FAR * nls, UWORD ch)
|
||||
{
|
||||
/* Check if it is a dual byte character */
|
||||
if (!nlsIsDBCS(ch & 0xFF)) {
|
||||
ch &= 0xFF;
|
||||
log(("NLS: nlsYesNo(): in ch=%u (%c)\n", ch, ch > 32 ? (char)ch : ' '));
|
||||
xUpMem(nls, MK_FP(_SS, &ch), 1); /* Upcase character */
|
||||
/* Cannot use DosUpChar(), because
|
||||
maybe: nls != current NLS pkg
|
||||
However: Upcase character within lowlevel
|
||||
function to allow a yesNo() function
|
||||
catched by external MUX-14 handler, which
|
||||
does NOT upcase character. */
|
||||
log(("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch > 32 ? (char)ch : ' '));
|
||||
}
|
||||
else
|
||||
log(("NLS: nlsYesNo(): in ch=%u (DBCS)\n", ch));
|
||||
|
||||
if (ch == nls->yeschar)
|
||||
return 1;
|
||||
if (ch == nls->nochar)
|
||||
@ -422,7 +479,7 @@ STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch)
|
||||
***** DOS API ******************************************************
|
||||
********************************************************************/
|
||||
|
||||
BYTE DosYesNo(unsigned char ch)
|
||||
BYTE DosYesNo(UWORD ch)
|
||||
/* returns: 0: ch == "No", 1: ch == "Yes", 2: ch crap */
|
||||
{
|
||||
if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_YESNO)
|
||||
@ -467,7 +524,7 @@ VOID DosUpFMem(VOID FAR * str, unsigned len)
|
||||
log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str),
|
||||
FP_OFF(str)));
|
||||
for (c = 0; c < len; ++c)
|
||||
printf("%c", str[c] > 32 ? str[c] : '.');
|
||||
printf("%c", ((char FAR *)str)[c] > 32 ? ((char FAR *)str)[c] : '.');
|
||||
printf("\"\n");
|
||||
#endif
|
||||
if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_FUPCASE)
|
||||
@ -511,19 +568,21 @@ COUNT DosGetData(int subfct, UWORD cp, UWORD cntry, UWORD bufsize,
|
||||
return DE_INVLDFUNC;
|
||||
|
||||
/* nls := NLS package of cntry/codepage */
|
||||
if ((nls = searchPackage(cp, cntry)) == NULL
|
||||
|| (nls->flags & NLS_FLAG_DIRECT_GETDATA) == 0)
|
||||
if ((nls = searchPackage(cp, cntry)) != NULL)
|
||||
{
|
||||
/* If the NLS pkg is not loaded into memory or the
|
||||
direct-access flag is disabled, the request must
|
||||
be passed through MUX */
|
||||
return (subfct == NLS_DOS_38)
|
||||
? mux38(nls->cp, nls->cntry, bufsize, buf)
|
||||
: mux65(subfct, nls->cp, nls->cntry, bufsize, buf);
|
||||
/* matching NLS package found */
|
||||
if (nls->flags & NLS_FLAG_DIRECT_GETDATA)
|
||||
/* Direct access to the data */
|
||||
return nlsGetData(nls, subfct, buf, bufsize);
|
||||
cp = nls->cp;
|
||||
cntry = nls->cntry;
|
||||
}
|
||||
|
||||
/* Direct access to the data */
|
||||
return nlsGetData(nls, subfct, buf, bufsize);
|
||||
/* If the NLS pkg is not loaded into memory or the direct-access
|
||||
flag is disabled, the request must be passed through MUX */
|
||||
return (subfct == NLS_DOS_38)
|
||||
? mux38(cp, cntry, bufsize, buf)
|
||||
: mux65(subfct, cp, cntry, bufsize, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -554,7 +613,7 @@ COUNT DosGetCountryInformation(UWORD cntry, VOID FAR * buf)
|
||||
#ifndef DosSetCountry
|
||||
COUNT DosSetCountry(UWORD cntry)
|
||||
{
|
||||
return DosSetPackage(NLS_DEFAULT, cntry);
|
||||
return DosLoadPackage(NLS_DEFAULT, cntry);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -580,6 +639,11 @@ COUNT DosSetCodepage(UWORD actCP, UWORD sysCP)
|
||||
return DE_INVLDDATA;
|
||||
}
|
||||
|
||||
VOID FAR *DosGetDBCS(void)
|
||||
{
|
||||
return getTable7(nlsInfo.actPkg);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
***** MUX-14 API ***************************************************
|
||||
********************************************************************/
|
||||
@ -626,10 +690,11 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS)
|
||||
/* Does not pass buffer length */
|
||||
return nlsGetData(nls, CL, MK_FP(ES, DI), 512);
|
||||
case NLSFUNC_LOAD_PKG:
|
||||
return nlsLoadPackage(nls);
|
||||
case NLSFUNC_LOAD_PKG2:
|
||||
return nlsSetPackage(nls);
|
||||
case NLSFUNC_YESNO:
|
||||
return nlsYesNo(nls, CL);
|
||||
return nlsYesNo(nls, CX);
|
||||
case NLSFUNC_UPMEM:
|
||||
nlsUpMem(nls, MK_FP(ES, DI), CX);
|
||||
return SUCCESS;
|
||||
|
@ -12,7 +12,7 @@ segment CONST2
|
||||
GLOBAL _nlsPackageHardcoded
|
||||
_nlsPackageHardcoded:
|
||||
DB 000h, 000h, 000h, 000h, 001h, 000h, 0b5h, 001h
|
||||
DB 00fh, 000h, 059h, 04eh, 006h, 000h
|
||||
DB 00fh, 000h, 059h, 000h, 04eh, 000h, 006h, 000h
|
||||
DB 002h
|
||||
DW ?table2, SEG ?table2
|
||||
DB 004h
|
||||
@ -26,6 +26,8 @@ _nlsPackageHardcoded:
|
||||
GLOBAL _nlsCountryInfoHardcoded
|
||||
_nlsCountryInfoHardcoded:
|
||||
DB 001h
|
||||
GLOBAL _nlsCntryInfoHardcoded
|
||||
_nlsCntryInfoHardcoded:
|
||||
?table1:
|
||||
DB 01ch, 000h, 001h, 000h, 0b5h, 001h, 000h, 000h
|
||||
DB 024h, 000h, 000h, 000h, 000h, 02ch, 000h, 02eh
|
||||
@ -35,12 +37,29 @@ extern _CharMapSrvc:wrt DGROUP
|
||||
DB 02ch, 000h
|
||||
GLOBAL _hcTablesStart
|
||||
_hcTablesStart:
|
||||
GLOBAL _nlsFUpcaseHardcoded
|
||||
_nlsFUpcaseHardcoded:
|
||||
?table4:
|
||||
GLOBAL _nlsUpcaseHardcoded
|
||||
_nlsUpcaseHardcoded:
|
||||
?table2:
|
||||
DB 080h, 000h, 080h, 09ah, 045h, 041h, 08eh, 041h
|
||||
DB 08fh, 080h, 045h, 045h, 045h, 049h, 049h, 049h
|
||||
DB 08eh, 08fh, 090h, 092h, 092h, 04fh, 099h, 04fh
|
||||
DB 055h, 055h, 059h, 099h, 09ah, 09bh, 09ch, 09dh
|
||||
DB 09eh, 09fh, 041h, 049h, 04fh, 055h, 0a5h, 0a5h
|
||||
DB 0a6h, 0a7h, 0a8h, 0a9h, 0aah, 0abh, 0ach, 0adh
|
||||
DB 0aeh, 0afh, 0b0h, 0b1h, 0b2h, 0b3h, 0b4h, 0b5h
|
||||
DB 0b6h, 0b7h, 0b8h, 0b9h, 0bah, 0bbh, 0bch, 0bdh
|
||||
DB 0beh, 0bfh, 0c0h, 0c1h, 0c2h, 0c3h, 0c4h, 0c5h
|
||||
DB 0c6h, 0c7h, 0c8h, 0c9h, 0cah, 0cbh, 0cch, 0cdh
|
||||
DB 0ceh, 0cfh, 0d0h, 0d1h, 0d2h, 0d3h, 0d4h, 0d5h
|
||||
DB 0d6h, 0d7h, 0d8h, 0d9h, 0dah, 0dbh, 0dch, 0ddh
|
||||
DB 0deh, 0dfh, 0e0h, 0e1h, 0e2h, 0e3h, 0e4h, 0e5h
|
||||
DB 0e6h, 0e7h, 0e8h, 0e9h, 0eah, 0ebh, 0ech, 0edh
|
||||
DB 0eeh, 0efh, 0f0h, 0f1h, 0f2h, 0f3h, 0f4h, 0f5h
|
||||
DB 0f6h, 0f7h, 0f8h, 0f9h, 0fah, 0fbh, 0fch, 0fdh
|
||||
DB 0feh, 0ffh
|
||||
GLOBAL _nlsFUpcaseHardcoded
|
||||
_nlsFUpcaseHardcoded:
|
||||
?table4:
|
||||
DB 080h, 000h, 080h, 09ah, 045h, 041h, 08eh, 041h
|
||||
DB 08fh, 080h, 045h, 045h, 045h, 049h, 049h, 049h
|
||||
DB 08eh, 08fh, 090h, 092h, 092h, 04fh, 099h, 04fh
|
||||
|
@ -258,7 +258,7 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip);
|
||||
COUNT lfn_dir_write(COUNT handle);
|
||||
|
||||
/* nls.c */
|
||||
BYTE DosYesNo(unsigned char ch);
|
||||
BYTE DosYesNo(UWORD ch);
|
||||
#ifndef DosUpMem
|
||||
VOID DosUpMem(VOID FAR * str, unsigned len);
|
||||
#endif
|
||||
@ -277,6 +277,7 @@ COUNT DosSetCountry(UWORD cntry);
|
||||
#endif
|
||||
COUNT DosGetCodepage(UWORD * actCP, UWORD * sysCP);
|
||||
COUNT DosSetCodepage(UWORD actCP, UWORD sysCP);
|
||||
VOID FAR *DosGetDBCS(void);
|
||||
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
|
||||
|
||||
/* prf.c */
|
||||
|
Loading…
x
Reference in New Issue
Block a user