From johnnyreb.4@southland.smart.net.SPAMMEN.VERBOTEN Mon Feb 4 15:00:31 2002 Path: ulcc.ac.uk!server3.netnews.ja.net!newspeer.clara.net!news.clara.net!colt.net!news.maxwell.syr.edu!sn-xit-03!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Ray Chason Newsgroups: rec.games.roguelike.nethack Subject: PATCH: Fix for NT keyboard and support for ISO-8859-1 character set: part 3, technical notes Date: Fri, 01 Feb 2002 04:16:59 -0000 Organization: Not bloody likely Message-ID: X-Newsreader: Royal News, Alpha 1 X-MS-Windows-95: Where do you want to go today? X-MS-Windows-XP: All your base are belong to us. X-Complaints-To: newsabuse@supernews.com Lines: 67 Xref: ulcc.ac.uk rec.games.roguelike.nethack:158052 If you are not a source diver, you can skip this section. The changes and their purposes are: * include/flag.h and src/options.c: Add the boolean options "accents" and "IBMcharset". * src/drawing.c: modify the graphics when IBMcharset is false, to avoid unavailable characters. * sys/msdos/video.c and sys/share/pcsys.c: Convert the internal representation (straight ISO-8859-1) into the permuted version that is IBM code page 850, and honor IBMcharset by mapping unavailable characters to US ASCII. * sys/share/unixtty.c: Modify linux_mapon and linux_mapoff to use fwrite(3) rather than write(2). Otherwise, the strings that switch the screen mode will be printed out of order, and wrong characters will be printed. * sys/winnt/Makefile.nt: add user32.lib to the link; this bears the ToAscii function, used by the revised keyboard reader. * sys/winnt/nttty.c: Use the ToAscii function to convert scan codes to characters. FIXME: This is kludgy as hell. Cursed be Bill Gates and his spawn to the seventh generation. This works in Win98, but I haven't tried it in NT. See also sys/msdos/video.c. * util/lev_main.c: provide dummy linux_mapon and linux_mapoff functions to avoid a link error due to calling these from src/drawing.c. * win/tty/termcap.c: Divert output into putchar2, puts2, and fputs2. * win/tty/topl.c: A kludge to support the '/' command, which identifies a map symbol, develops a bug when 8-bit characters are in use: when such a character begins a line, it is mistaken for a map symbol and misprinted. Change so that this is invoked only when a space follows; not perfect, but good enough for now. Also divert output into putchar2. * win/tty/wintty.c: Define putchar2, puts2, and fputs2, which replace putchar, puts, and fputs when the output goes to stdout and may contain diacritics. These map the diacritics according to the accent and IBMcharset options. Some further notes: * OS/2 is not yet supported. When Spanish Nethack supports OS/2, so will this patch, with modifications to support non-USA keyboards if it should prove necessary. * The patch does somewhat more than needed for English Nethack, because it internally maps the native character set to ISO-8859-1. This is a no-op for Linux, but for MSDOS and NT (and OS/2 when support becomes available) it does add to the size of the patch. The remapping is a must for Spanish Nethack, because internal messages are encoded in ISO-8859-1; but for English Nethack, only user input would ever include the high characters, and we could get by without the remapping. -- --------------===============<[ Ray Chason ]>===============-------------- PGP public key at http://www.smart.net/~rchason/pubkey.asc Delenda est Windoze