add some unicode support (trunk only)

This patch attempts to add some levels of unicode support
to NetHack.

The master on/off switch for any Unicode support is
defining UNICODE_SUPPORT in config.h. Currently
there is code support for two subsets of unicode support:

UNICODE_DRAWING

If UNICODE_DRAWING is defined, then the data
structures used to house drawing symbols are expanded
to the size of wchar_t, big enough to hold unicode characters.
A typdef called `nhsym' is involved and if UNICODE_DRAWING
is defined, it is wchar_t, otherwise it is uchar.

UNICODE_WIDEWINPORT

If UNICODE_WIDEWINPORT is defined, then the data
structures inside the window port are expanded to the size of
wchar_t, big enough to hold unicode characters.  Both map
symbols and text within the window port are expanded, in order
for potential support for displaying multinational characters some
day, but this patch only provides viewing of map symbols.
A typdef called `nhwchar' is involved and if UNICODE_WIDEWINPORT
is defined, it is wchar_t, otherwise it is char.

The only window port with code support for UNICODE_WIDEWINPORT
currently is the TTY port.  Don't enable UNICODE_WIDEWINPORT
unless:
- it is a TTY port
- the underlying platform specific routines can
handle the larger data structures.

Don't enable UNICODE_SUPPORT unless:
- your compiler can handle wchar_t.
- your compiler can accept L'a' characters.
- your compiler can accept L"wide" strings.

Note that if your compiler can handle the above, you could
enable the larger data structures (currently if TTY) even if your
platform can't actually display unicode or UTF-8, by messing
with u_putch() in win/tty/wintty.c to only deal regular chars.
That should be the only function that actually pushes wide characters
out to the display.

If you enable UNICODE_SUPPORT, and your platform is capable
you will need to turn on the unicode run-time option to be able to
load unicode character sets from the symbol file, to be able to
push unicode characters to the display. You'll also want to load
a unicode symbol set once the unicode option is toggled on. In
a config file you would do that via these two lines:
OPTIONS=unicode
OPTIONS=symset:Unicode_non_US

The repository was stamped with NETHACK_PRE_UNICODE
prior to applying this patch, and stamped with
NETHACK_POST_UNICODE afterwards. The code differences
between those two tagged versions are this patch.
This commit is contained in:
nethack.allison
2006-10-17 23:55:42 +00:00
parent 3054c1c846
commit 7f0f43e6f9
22 changed files with 1193 additions and 177 deletions

View File

@@ -201,6 +201,10 @@ start: RogueEpyx
S_food: \x05 # club (as in cards)
S_potion: \xad # upside down '!'
S_scroll: \x0e # musical note
# S_armor: \x5b
# S_ring: \x3d
# S_amulet: \x0c
# S_tool: \x28
S_wand: \xe7 # greek tau
S_coin: \x0f # yes it's the same as gems
S_gem: \x0f # fancy '*'
@@ -393,3 +397,131 @@ start: NHAccess
S_explode9: \047
finish
start: Unicode_US
Description: Unicode symbols similar to code page 437
Restrictions: Unicode
S_vwall: U+2502 # box drawings light vertical
S_hwall: U+2500 # box drawings light horizontal
S_tlcorn: U+250C # box drawings light down and right
S_trcorn: U+2510 # box drawings light down and left
S_blcorn: U+2514 # box drawings light up and right
S_brcorn: U+2518 # box drawings light up and left
S_crwall: U+253C # box drawings light up and left
S_tuwall: U+2534 # box drawings light up and horizontal
S_tdwall: U+252C # box drawings light down and horizontal
S_tlwall: U+2524 # box drawings light vertical and left
S_trwall: U+251C # box drawings light vertical and right
S_ndoor: U+2556 # box drawings down double and left single
S_vodoor: U+25A0 # black square
S_hodoor: U+25A0 # black square
S_bars: U+2261 # identical to
S_tree: U+00B1 # plus-minus sign
S_room: U+00B7 # middle dot
S_corr: U+2591 # light shade
S_litcorr: U+2592 # medium shade
S_fountain: U+2320 # top half integral
S_pool: U+2248 # almost equal to
S_ice: U+00B7 # middle dot
S_lava: U+2248 # almost equal to
S_vodbridge: U+00B7 # middle dot
S_hodbridge: U+00B7 # middle dot
S_water: U+2248 # almost equal to
S_vbeam: U+2502 # box drawings light vertical
S_hbeam: U+2500 # box drawings light horizontal
S_sw_ml: U+2502 # box drawings light vertical
S_sw_mr: U+2502 # box drawings light vertical
S_explode4: U+2502 # box drawings light vertical
S_explode6: U+2502 # box drawings light vertical
finish
start: Unicode_non_US
Description: If default OEM CP for non-Unicode programs is not 437 or 850
Restrictions: Unicode
S_vwall: U+2502 # box drawings light vertical
S_hwall: U+2500 # box drawings light horizontal
S_tlcorn: U+250C # box drawings light down and right
S_trcorn: U+2510 # box drawings light down and left
S_blcorn: U+2514 # box drawings light up and right
S_brcorn: U+2518 # box drawings light up and left
S_crwall: U+253C # box drawings light up and left
S_tuwall: U+2534 # box drawings light up and horizontal
S_tdwall: U+252C # box drawings light down and horizontal
S_tlwall: U+2524 # box drawings light vertical and left
S_trwall: U+251C # box drawings light vertical and right
S_vodoor: U+25A0 # black square
S_hodoor: U+25A0 # black square
S_corr: U+2591 # light shade
S_litcorr: U+2592 # medium shade
S_vbeam: U+2502 # box drawings light vertical
S_hbeam: U+2500 # box drawings light horizontal
S_sw_ml: U+2502 # box drawings light vertical
S_sw_mr: U+2502 # box drawings light vertical
S_explode4: U+2502 # box drawings light vertical
S_explode6: U+2502 # box drawings light vertical
S_coin: U+20AC # euro
finish
start: UnicodeRogueEpyx
Description: Unicode Rogue level symbols
Restrictions: Unicode
Restrictions: Rogue
Color: Yes
S_weapon: U+2191 # up arrow
S_armor: U+25d9 # Vert rect with o
S_ring: U+2642 # circle with arrow
S_amulet: U+2640 # "female" symbol
S_food: U+2663 # club (as in cards)
S_potion: U+00a1 # upside down '!'
S_scroll: U+266a # musical note
S_wand: U+03c4 # greek tau
S_coin: U+263c # yes it's the same as gems
S_gem: U+263c # fancy '*'
S_rock: U+0060 # grave accent
S_ball: U+0030 # digit 0
S_chain: U+005f # low line
S_venom: U+002e # full stop
S_book: U+002b # + sign
S_vwall: U+2551 # all walls now use
S_hwall: U+2550 # double line graphics
S_tlcorn: U+2554 # box drawing double down and right
S_trcorn: U+2557 # box drawing double down and left
S_blcorn: U+255a # box drawing double up and right
S_brcorn: U+255d # box drawing double up and left
S_crwall: U+256c # box drawing double vertical and horizontal
S_tuwall: U+2569 # box drawing double up and horizontal
S_tdwall: U+2566 # box drawing double down and horizontal
S_tlwall: U+2563 # box drawing double vertical and left
S_trwall: U+2560 # box drawing double vertical and right
S_ndoor: U+256c # box drawing double vertical and horizontal
S_vodoor: U+256c # box drawing double vertical and horizontal
S_hodoor: U+256c # box drawing double vertical and horizontal
S_room: U+00b7 # centered dot
S_corr: U+2592 # medium shade
S_litcorr: U+2593 # dark shade
S_upstair: U+001e # Greek Xi
S_dnstair: U+001f
S_arrow_trap: U+2666 # diamond (cards)
S_dart_trap: U+2666
S_falling_rock_trap: U+2666
S_squeaky_board: U+2666
S_bear_trap: U+2666
S_land_mine: U+2666
S_rolling_boulder_trap: U+2666
S_sleeping_gas_trap: U+2666
S_rust_trap: U+2666
S_fire_trap: U+2666
S_pit: U+2666
S_spiked_pit: U+2666
S_hole: U+2666
S_trap_door: U+2666
S_teleportation_trap: U+2666
S_level_teleporter: U+2666
S_magic_portal: U+2666
S_web: U+2666
S_statue_trap: U+2666
S_magic_trap: U+2666
S_anti_magic_trap: U+2666
S_polymorph_trap: U+2666
S_human: U+263a # face
finish