By Eduardo Casino-Almao:

adds DBCS support to DOS-65-23 (Determine if a character represents
yes/no response) as specified by RBIL, and fixes DOS-63-00 (Get
Double Byte Character Set lead-byte table.) It now returns the DBCS
table from the active NLS package, not the harcoded one.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1040 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Luchezar Georgiev 2004-09-12 17:47:21 +00:00
parent e0dfeaada1
commit 6e7cf96323
6 changed files with 92 additions and 26 deletions

View File

@ -342,13 +342,36 @@
(the last 2 changes proposed by Bart Oldeman) (the last 2 changes proposed by Bart Oldeman)
+ Changes Eduardo + Changes Eduardo
* country.asm: added NLS uppercase/collating tables (437,850,857,858) * country.asm: added NLS uppercase/collating tables (437,850,857,858)
* inthndlr.c: added Int 2Fh/26-29h processing for NLSFUNC (with Lucho) * inthndlr.c:
- added Int 2Fh/26-29h processing for NLSFUNC (with Lucho)
- DOS-63-00 returns DBCS table from the active NLS package, not the
harcoded one.
- DOS-65-23: DosYesNo() arg is now DX, not DL.
* nls.c: MuxLoadPkg(), MuxGo() functions modified for NLSFUNC * nls.c: MuxLoadPkg(), MuxGo() functions modified for NLSFUNC
- New macro getTable7()
- New functions nlsIsDBCS() (check if a byte is a dual byte char
leadbyte) and DosGetDBCS() (returns DBCS table from the active NLS
package)
- Add DBCS table to getTable() and fixes references to harcoded
UCASE and FUCASE tables.
- DosYesNo(): arg is now UWORD, not unsigned char.
- nlsYesNo(): Add DBCS support
- syscall_MUX14(): arg of nlsYesNo() is now CX instead of CL.
* nls.h:
- yeschar and nochar are now UWORD instead of UBYTE.
- NLS_FREEDOS_NLSFUNC_VERSION bumped to 0xFD02.
- Add a small comment.
* nls_hc.asm: YesChar and NoChar are now two bytes each.
* proto.h:
- DosYesNo(): Argument is now UWORD (dual byte)
- Add prototype for DosGetDBCS()
+ Changes Jeremy + Changes Jeremy
* config.txt * config.txt
- update to include all CONFIG.SYS options (except ANYDOS) - update to include all CONFIG.SYS options (except ANYDOS)
* exeflat.c * exeflat.c
- show usage also when number of arguments incorrect - show usage also when number of arguments incorrect
< many other changes to be added by Jeremy himself :->
*** Sync - Stable Build 2035 *** *** Sync - Stable Build 2035 ***
2004 May 30 - Build 2035 2004 May 30 - Build 2035

View File

@ -269,6 +269,8 @@
* information itself; it is ignored when the user calls DOS-65-0x * information itself; it is ignored when the user calls DOS-65-0x
* to return such pointer. * to return such pointer.
* NLS_REORDER_POINTERS is *enabled* by default. * 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 /* Define if some user program possibly modifies the value of the internal
@ -289,7 +291,7 @@
/* What version of nlsInfo and accompanying associations /* What version of nlsInfo and accompanying associations
Must be passed to NLSFUNC upon MUX-14-00 to identify the Must be passed to NLSFUNC upon MUX-14-00 to identify the
correct kernel to the tools. */ 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. /* Represents a call to DOS-38 within DOS-65 handlers.
Current implementation relys on 0x101! */ Current implementation relys on 0x101! */
#define NLS_DOS_38 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 MUX-14 processor does not require them and performs
all actions itself, so that the kernel never tries to all actions itself, so that the kernel never tries to
fetch this information itself. */ fetch this information itself. */
UBYTE yeschar; /* yes / no character DOS-65-23 */ UWORD yeschar; /* yes / no character DOS-65-23 */
UBYTE nochar; UWORD nochar;
unsigned numSubfct; /* number of supported sub-functions */ unsigned numSubfct; /* number of supported sub-functions */
struct nlsPointer nlsPointers[1]; /* grows dynamically */ struct nlsPointer nlsPointers[1]; /* grows dynamically */
}; };
@ -570,8 +572,8 @@ struct csys_ccDefinition { /* country/codepage reference */
UWORD cntry, cp; is missing UWORD cntry, cp; is missing
int flags; is NLS_FLAG_HARDCODED, if the int flags; is NLS_FLAG_HARDCODED, if the
kernel is to handle the data of its own kernel is to handle the data of its own
UBYTE yeschar; is filled UWORD yeschar; is filled
UBYTE nochar; is filled UWORD nochar; is filled
unsigned numSubfct; is filled unsigned numSubfct; is filled
struct nlsPointer nlsPointers[1]; is filled struct nlsPointer nlsPointers[1]; is filled
the pointer member is the absolute the pointer member is the absolute

View File

@ -1288,8 +1288,15 @@ dispatch:
/* UNDOCUMENTED: Double byte and korean tables */ /* UNDOCUMENTED: Double byte and korean tables */
case 0x63: case 0x63:
{ {
lr.DS = FP_SEG(&nlsDBCSHardcoded); VOID FAR *p;
lr.SI = FP_OFF(&nlsDBCSHardcoded);
if (lr.AL == 0) {
p = DosGetDBCS();
lr.DS = FP_SEG(p);
lr.SI = FP_OFF(p);
}
lr.AL = 0x00;
#if 0 #if 0
/* not really supported, but will pass. */ /* not really supported, but will pass. */
lr.AL = 0x00; /*jpp: according to interrupt list */ lr.AL = 0x00; /*jpp: according to interrupt list */
@ -1326,7 +1333,7 @@ dispatch:
DosUpFString(FP_DS_DX); DosUpFString(FP_DS_DX);
break; break;
case 0x23: /* check Yes/No response */ case 0x23: /* check Yes/No response */
lr.AX = DosYesNo(lr.DL); lr.AX = DosYesNo(lr.DX);
break; break;
default: default:
#ifdef NLS_DEBUG #ifdef NLS_DEBUG

View File

@ -75,9 +75,11 @@ struct nlsInfoBlock nlsInfo = {
#ifdef NLS_REORDER_POINTERS #ifdef NLS_REORDER_POINTERS
#define getTable2(nls) ((nls)->nlsPointers[0].pointer) #define getTable2(nls) ((nls)->nlsPointers[0].pointer)
#define getTable4(nls) ((nls)->nlsPointers[1].pointer) #define getTable4(nls) ((nls)->nlsPointers[1].pointer)
#define getTable7(nls) ((nls)->nlsPointers[4].pointer)
#else #else
#define getTable2(nls) getTable(2, (nls)) #define getTable2(nls) getTable(2, (nls))
#define getTable4(nls) getTable(4, (nls)) #define getTable4(nls) getTable(4, (nls))
#define getTable7(nls) getTable(7, (nls))
#define NEED_GET_TABLE #define NEED_GET_TABLE
#endif #endif
/*== both chartables must be 128 bytes long and lower range is /*== both chartables must be 128 bytes long and lower range is
@ -213,12 +215,15 @@ STATIC VOID FAR *getTable(UBYTE subfct, struct nlsPackage FAR * nls)
switch (subfct) switch (subfct)
{ {
case 2: case 2:
return &nlsUpHardcodedTable; return &nlsUpcaseHardcoded;
case 4: case 4:
return &nlsFnameUpHardcodedTable; return &nlsFUpcaseHardcoded;
/* case 5: return &nlsFnameTermHardcodedTable; */ /* case 5: return &nlsFnameTermHardcodedTable; */
/* case 6: return &nlsCollHardcodedTable; */ /* case 6: return &nlsCollHardcodedTable; */
case 7:
return &nlsDBCSHardcoded;
} }
return NULL;
} }
#endif #endif
@ -422,18 +427,41 @@ STATIC VOID xUpMem(struct nlsPackage FAR * nls, VOID FAR * str,
muxBufGo(NLSFUNC_UPMEM, 0, nls->cp, nls->cntry, len, 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 */ if (ch < 128)
/* Cannot use DosUpChar(), because return FALSE; /* No leadbyte is smaller than that */
maybe: nls != current NLS pkg
However: Upcase character within lowlevel {
function to allow a yesNo() function UWORD FAR *t= ((struct nlsDBCS FAR*)getTable7(nlsInfo.actPkg))->dbcsTbl;
catched by external MUX-14 handler, which
does NOT upcase character. */ for (; *t != 0; ++t)
log(("NLS: nlsYesNo(): upcased ch=%u (%c)\n", ch, ch > 32 ? ch : ' ')); 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) if (ch == nls->yeschar)
return 1; return 1;
if (ch == nls->nochar) if (ch == nls->nochar)
@ -445,7 +473,7 @@ STATIC int nlsYesNo(struct nlsPackage FAR * nls, unsigned char ch)
***** DOS API ****************************************************** ***** DOS API ******************************************************
********************************************************************/ ********************************************************************/
BYTE DosYesNo(unsigned char ch) BYTE DosYesNo(UWORD ch)
/* returns: 0: ch == "No", 1: ch == "Yes", 2: ch crap */ /* returns: 0: ch == "No", 1: ch == "Yes", 2: ch crap */
{ {
if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_YESNO) if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_YESNO)
@ -490,7 +518,7 @@ VOID DosUpFMem(VOID FAR * str, unsigned len)
log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str), log(("NLS: DosUpFMem(): len=%u, %04x:%04x=\"", len, FP_SEG(str),
FP_OFF(str))); FP_OFF(str)));
for (c = 0; c < len; ++c) 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"); printf("\"\n");
#endif #endif
if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_FUPCASE) if (nlsInfo.actPkg->flags & NLS_FLAG_DIRECT_FUPCASE)
@ -605,6 +633,11 @@ COUNT DosSetCodepage(UWORD actCP, UWORD sysCP)
return DE_INVLDDATA; return DE_INVLDDATA;
} }
VOID FAR *DosGetDBCS(void)
{
return getTable7(nlsInfo.actPkg);
}
/******************************************************************** /********************************************************************
***** MUX-14 API *************************************************** ***** MUX-14 API ***************************************************
********************************************************************/ ********************************************************************/
@ -655,7 +688,7 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS)
case NLSFUNC_LOAD_PKG2: case NLSFUNC_LOAD_PKG2:
return nlsSetPackage(nls); return nlsSetPackage(nls);
case NLSFUNC_YESNO: case NLSFUNC_YESNO:
return nlsYesNo(nls, CL); return nlsYesNo(nls, CX);
case NLSFUNC_UPMEM: case NLSFUNC_UPMEM:
nlsUpMem(nls, MK_FP(ES, DI), CX); nlsUpMem(nls, MK_FP(ES, DI), CX);
return SUCCESS; return SUCCESS;

View File

@ -12,7 +12,7 @@ segment CONST2
GLOBAL _nlsPackageHardcoded GLOBAL _nlsPackageHardcoded
_nlsPackageHardcoded: _nlsPackageHardcoded:
DB 000h, 000h, 000h, 000h, 001h, 000h, 0b5h, 001h 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 DB 002h
DW ?table2, SEG ?table2 DW ?table2, SEG ?table2
DB 004h DB 004h

View File

@ -271,7 +271,7 @@ COUNT lfn_dir_read(COUNT handle, lfn_inode_ptr lip);
COUNT lfn_dir_write(COUNT handle); COUNT lfn_dir_write(COUNT handle);
/* nls.c */ /* nls.c */
BYTE DosYesNo(unsigned char ch); BYTE DosYesNo(UWORD ch);
#ifndef DosUpMem #ifndef DosUpMem
VOID DosUpMem(VOID FAR * str, unsigned len); VOID DosUpMem(VOID FAR * str, unsigned len);
#endif #endif
@ -290,6 +290,7 @@ COUNT DosSetCountry(UWORD cntry);
#endif #endif
COUNT DosGetCodepage(UWORD * actCP, UWORD * sysCP); COUNT DosGetCodepage(UWORD * actCP, UWORD * sysCP);
COUNT DosSetCodepage(UWORD actCP, UWORD sysCP); COUNT DosSetCodepage(UWORD actCP, UWORD sysCP);
VOID FAR *DosGetDBCS(void);
UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS); UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
/* prf.c */ /* prf.c */