1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Changeset 738

Show
Ignore:
Timestamp:
01/22/11 14:44:13 (16 months ago)
Author:
bhaak
Message:

UTF-8 glyphs in map

Location:
trunk
Files:
1 added
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/configure

    r677 r738  
    749749enable_dump_html_css_file 
    750750enable_dump_html_css_embedded 
     751enable_utf8_glyphs 
    751752enable_whereis_file 
    752753enable_wizmode 
     
    14501451                          CSS file should be included in the HTML dump 
    14511452                          (default=no) 
     1453  --enable-utf8-glyphs    Enable UTF-8 glyphs in TTY (default=yes) 
    14521454  --enable-whereis-file=FILE 
    14531455                          Log information about running games (default=no, 
     
    20102012 
    20112013} # ac_fn_c_check_func 
     2014 
     2015# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES 
     2016# -------------------------------------------- 
     2017# Tries to find the compile-time value of EXPR in a program that includes 
     2018# INCLUDES, setting VAR accordingly. Returns whether the value could be 
     2019# computed 
     2020ac_fn_c_compute_int () 
     2021{ 
     2022  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack 
     2023  if test "$cross_compiling" = yes; then 
     2024    # Depending upon the size, compute the lo and hi bounds. 
     2025cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2026/* end confdefs.h.  */ 
     2027$4 
     2028int 
     2029main () 
     2030{ 
     2031static int test_array [1 - 2 * !(($2) >= 0)]; 
     2032test_array [0] = 0 
     2033 
     2034  ; 
     2035  return 0; 
     2036} 
     2037_ACEOF 
     2038if ac_fn_c_try_compile "$LINENO"; then : 
     2039  ac_lo=0 ac_mid=0 
     2040  while :; do 
     2041    cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2042/* end confdefs.h.  */ 
     2043$4 
     2044int 
     2045main () 
     2046{ 
     2047static int test_array [1 - 2 * !(($2) <= $ac_mid)]; 
     2048test_array [0] = 0 
     2049 
     2050  ; 
     2051  return 0; 
     2052} 
     2053_ACEOF 
     2054if ac_fn_c_try_compile "$LINENO"; then : 
     2055  ac_hi=$ac_mid; break 
     2056else 
     2057  as_fn_arith $ac_mid + 1 && ac_lo=$as_val 
     2058                        if test $ac_lo -le $ac_mid; then 
     2059                          ac_lo= ac_hi= 
     2060                          break 
     2061                        fi 
     2062                        as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val 
     2063fi 
     2064rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2065  done 
     2066else 
     2067  cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2068/* end confdefs.h.  */ 
     2069$4 
     2070int 
     2071main () 
     2072{ 
     2073static int test_array [1 - 2 * !(($2) < 0)]; 
     2074test_array [0] = 0 
     2075 
     2076  ; 
     2077  return 0; 
     2078} 
     2079_ACEOF 
     2080if ac_fn_c_try_compile "$LINENO"; then : 
     2081  ac_hi=-1 ac_mid=-1 
     2082  while :; do 
     2083    cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2084/* end confdefs.h.  */ 
     2085$4 
     2086int 
     2087main () 
     2088{ 
     2089static int test_array [1 - 2 * !(($2) >= $ac_mid)]; 
     2090test_array [0] = 0 
     2091 
     2092  ; 
     2093  return 0; 
     2094} 
     2095_ACEOF 
     2096if ac_fn_c_try_compile "$LINENO"; then : 
     2097  ac_lo=$ac_mid; break 
     2098else 
     2099  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val 
     2100                        if test $ac_mid -le $ac_hi; then 
     2101                          ac_lo= ac_hi= 
     2102                          break 
     2103                        fi 
     2104                        as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val 
     2105fi 
     2106rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2107  done 
     2108else 
     2109  ac_lo= ac_hi= 
     2110fi 
     2111rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2112fi 
     2113rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2114# Binary search between lo and hi bounds. 
     2115while test "x$ac_lo" != "x$ac_hi"; do 
     2116  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val 
     2117  cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2118/* end confdefs.h.  */ 
     2119$4 
     2120int 
     2121main () 
     2122{ 
     2123static int test_array [1 - 2 * !(($2) <= $ac_mid)]; 
     2124test_array [0] = 0 
     2125 
     2126  ; 
     2127  return 0; 
     2128} 
     2129_ACEOF 
     2130if ac_fn_c_try_compile "$LINENO"; then : 
     2131  ac_hi=$ac_mid 
     2132else 
     2133  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val 
     2134fi 
     2135rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 
     2136done 
     2137case $ac_lo in #(( 
     2138?*) eval "$3=\$ac_lo"; ac_retval=0 ;; 
     2139'') ac_retval=1 ;; 
     2140esac 
     2141  else 
     2142    cat confdefs.h - <<_ACEOF >conftest.$ac_ext 
     2143/* end confdefs.h.  */ 
     2144$4 
     2145static long int longval () { return $2; } 
     2146static unsigned long int ulongval () { return $2; } 
     2147#include <stdio.h> 
     2148#include <stdlib.h> 
     2149int 
     2150main () 
     2151{ 
     2152 
     2153  FILE *f = fopen ("conftest.val", "w"); 
     2154  if (! f) 
     2155    return 1; 
     2156  if (($2) < 0) 
     2157    { 
     2158      long int i = longval (); 
     2159      if (i != ($2)) 
     2160        return 1; 
     2161      fprintf (f, "%ld", i); 
     2162    } 
     2163  else 
     2164    { 
     2165      unsigned long int i = ulongval (); 
     2166      if (i != ($2)) 
     2167        return 1; 
     2168      fprintf (f, "%lu", i); 
     2169    } 
     2170  /* Do not output a trailing newline, as this causes \r\n confusion 
     2171     on some platforms.  */ 
     2172  return ferror (f) || fclose (f) != 0; 
     2173 
     2174  ; 
     2175  return 0; 
     2176} 
     2177_ACEOF 
     2178if ac_fn_c_try_run "$LINENO"; then : 
     2179  echo >>conftest.val; read $3 <conftest.val; ac_retval=0 
     2180else 
     2181  ac_retval=1 
     2182fi 
     2183rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 
     2184  conftest.$ac_objext conftest.beam conftest.$ac_ext 
     2185rm -f conftest.val 
     2186 
     2187  fi 
     2188  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} 
     2189  as_fn_set_status $ac_retval 
     2190 
     2191} # ac_fn_c_compute_int 
    20122192cat >config.log <<_ACEOF 
    20132193This file contains any messages produced by compilers while 
     
    38123992esac 
    38133993 
    3814  
    38153994for ac_prog in flex lex 
    38163995do 
     
    55635742 
    55645743 
     5744 
     5745 
     5746ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" 
     5747if test "x$ac_cv_type_uint32_t" = x""yes; then : 
     5748 
     5749else 
     5750 
     5751  { $as_echo "$as_me:${as_lineno-$LINENO}: trying to find a suitable 4-byte replacement for uint32_t" >&5 
     5752$as_echo "$as_me: trying to find a suitable 4-byte replacement for uint32_t" >&6;} 
     5753  uint32_t=no 
     5754  find_uint32_t () 
     5755  { 
     5756 
     5757 
     5758  # The cast to long int works around a bug in the HP C Compiler 
     5759# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 
     5760# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 
     5761# This bug is HP SR number 8606223364. 
     5762{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned int" >&5 
     5763$as_echo_n "checking size of unsigned int... " >&6; } 
     5764if test "${ac_cv_sizeof_unsigned_int+set}" = set; then : 
     5765  $as_echo_n "(cached) " >&6 
     5766else 
     5767  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned int))" "ac_cv_sizeof_unsigned_int"        "$ac_includes_default"; then : 
     5768 
     5769else 
     5770  if test "$ac_cv_type_unsigned_int" = yes; then 
     5771     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 
     5772$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
     5773{ as_fn_set_status 77 
     5774as_fn_error "cannot compute sizeof (unsigned int) 
     5775See \`config.log' for more details." "$LINENO" 5; }; } 
     5776   else 
     5777     ac_cv_sizeof_unsigned_int=0 
     5778   fi 
     5779fi 
     5780 
     5781fi 
     5782{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_int" >&5 
     5783$as_echo "$ac_cv_sizeof_unsigned_int" >&6; } 
     5784 
     5785 
     5786 
     5787cat >>confdefs.h <<_ACEOF 
     5788#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int 
     5789_ACEOF 
     5790 
     5791 
     5792  if test "$ac_cv_sizeof_unsigned_int" -eq 4; then 
     5793    uint32_t="unsigned int" 
     5794    return 
     5795  fi 
     5796 
     5797 
     5798  # The cast to long int works around a bug in the HP C Compiler 
     5799# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 
     5800# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 
     5801# This bug is HP SR number 8606223364. 
     5802{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long" >&5 
     5803$as_echo_n "checking size of unsigned long... " >&6; } 
     5804if test "${ac_cv_sizeof_unsigned_long+set}" = set; then : 
     5805  $as_echo_n "(cached) " >&6 
     5806else 
     5807  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long"        "$ac_includes_default"; then : 
     5808 
     5809else 
     5810  if test "$ac_cv_type_unsigned_long" = yes; then 
     5811     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 
     5812$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
     5813{ as_fn_set_status 77 
     5814as_fn_error "cannot compute sizeof (unsigned long) 
     5815See \`config.log' for more details." "$LINENO" 5; }; } 
     5816   else 
     5817     ac_cv_sizeof_unsigned_long=0 
     5818   fi 
     5819fi 
     5820 
     5821fi 
     5822{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5 
     5823$as_echo "$ac_cv_sizeof_unsigned_long" >&6; } 
     5824 
     5825 
     5826 
     5827cat >>confdefs.h <<_ACEOF 
     5828#define SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long 
     5829_ACEOF 
     5830 
     5831 
     5832  if test "$ac_cv_sizeof_unsigned_long" -eq 4; then 
     5833    uint32_t="unsigned long" 
     5834    return 
     5835  fi 
     5836 
     5837 
     5838  # The cast to long int works around a bug in the HP C Compiler 
     5839# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects 
     5840# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. 
     5841# This bug is HP SR number 8606223364. 
     5842{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long long" >&5 
     5843$as_echo_n "checking size of unsigned long long... " >&6; } 
     5844if test "${ac_cv_sizeof_unsigned_long_long+set}" = set; then : 
     5845  $as_echo_n "(cached) " >&6 
     5846else 
     5847  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long long))" "ac_cv_sizeof_unsigned_long_long"        "$ac_includes_default"; then : 
     5848 
     5849else 
     5850  if test "$ac_cv_type_unsigned_long_long" = yes; then 
     5851     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 
     5852$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} 
     5853{ as_fn_set_status 77 
     5854as_fn_error "cannot compute sizeof (unsigned long long) 
     5855See \`config.log' for more details." "$LINENO" 5; }; } 
     5856   else 
     5857     ac_cv_sizeof_unsigned_long_long=0 
     5858   fi 
     5859fi 
     5860 
     5861fi 
     5862{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long_long" >&5 
     5863$as_echo "$ac_cv_sizeof_unsigned_long_long" >&6; } 
     5864 
     5865 
     5866 
     5867cat >>confdefs.h <<_ACEOF 
     5868#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long 
     5869_ACEOF 
     5870 
     5871 
     5872  if test "$ac_cv_sizeof_unsigned_long_long" -eq 4; then 
     5873    uint32_t="unsigned long long" 
     5874    return 
     5875  fi 
     5876 
     5877 
     5878 
     5879 
     5880 
     5881 
     5882 
     5883 
     5884    : 
     5885  } 
     5886  find_uint32_t 
     5887 
     5888cat >>confdefs.h <<_ACEOF 
     5889#define uint32_t $uint32_t 
     5890_ACEOF 
     5891 
     5892 
     5893fi 
     5894 
     5895 
     5896 
    55655897# Extract the first word of "nroff", so it can be a program name with args. 
    55665898set dummy nroff; ac_word=$2 
     
    65516883        fi 
    65526884fi 
     6885 
     6886if test "$enable_tty_graphics" != "no"; then 
     6887        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable utf8-glyphs" >&5 
     6888$as_echo_n "checking whether to enable utf8-glyphs... " >&6; } 
     6889   # Check whether --enable-utf8-glyphs was given. 
     6890if test "${enable_utf8_glyphs+set}" = set; then : 
     6891  enableval=$enable_utf8_glyphs; 
     6892else 
     6893  enable_utf8_glyphs="yes" 
     6894fi 
     6895 
     6896   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_utf8_glyphs" >&5 
     6897$as_echo "$enable_utf8_glyphs" >&6; } 
     6898   if test "$enable_utf8_glyphs" != "no" ; then 
     6899 
     6900cat >>confdefs.h <<_ACEOF 
     6901#define UTF8_GLYPHS /**/ 
     6902_ACEOF 
     6903 
     6904   fi 
     6905 
     6906        if test "$enable_utf8_glyphs" != "no" ; then 
     6907                                if test "$uint32_t" = no; then 
     6908                        as_fn_error "unable to continue without a 4-bytes datatype that could hold unicode codepoints" "$LINENO" 5 
     6909                fi 
     6910        fi 
     6911fi 
     6912 
    65536913 
    65546914{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable whereis file" >&5 
  • trunk/include/config.h

    r712 r738  
    292292#ifndef _AIX32          /* identical typedef in system file causes trouble */ 
    293293typedef unsigned char   uchar; 
     294#endif 
     295 
     296/* Type used for outputting DECgraphics and IBMgraphics characters into 
     297 * HTML dumps or for holding unicode codepoints. */ 
     298#if HAVE_INTTYPES_H 
     299# include <inttypes.h> 
     300#else 
     301# if HAVE_STDINT_H 
     302#  include <stdint.h> 
     303# endif 
     304#endif 
     305#ifdef UINT32_MAX 
     306typedef uint32_t glyph_t; 
     307#else 
     308/* Fallback that should work on most systems */ 
     309typedef long glyph_t; 
    294310#endif 
    295311 
  • trunk/include/extern.h

    r729 r738  
    470470E int FDECL(def_char_to_monclass, (CHAR_P)); 
    471471#if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) 
    472 E void FDECL(assign_graphics, (uchar *,int,int,int)); 
     472E void FDECL(assign_graphics, (glyph_t *,int,int,int)); 
    473473E void FDECL(switch_graphics, (int)); 
    474474#ifdef REINCARNATION 
     
    10281028/* ### mapglyph.c ### */ 
    10291029 
    1030 E void FDECL(mapglyph, (int, int *, int *, unsigned *, int, int)); 
     1030E void FDECL(mapglyph, (int, glyph_t *, int *, unsigned *, int, int)); 
    10311031 
    10321032/* ### mcastu.c ### */ 
     
    25532553E int FDECL(check_tutorial_location, (int, int, BOOLEAN_P)); 
    25542554 
     2555/* ### unicode.c ### */ 
     2556E glyph_t FDECL(get_unicode_codepoint, (int)); 
     2557E int FDECL(pututf8char, (glyph_t)); 
     2558 
    25552559#undef E 
    25562560 
  • trunk/include/flag.h

    r625 r738  
    191191        boolean  echo;          /* 1 to echo characters */ 
    192192        boolean  IBMgraphics;   /* use IBM extended character set */ 
     193        boolean  UTF8graphics;  /* use UTF-8 characters */ 
    193194        unsigned msg_history;   /* hint: # of top lines to save */ 
    194195        boolean  num_pad;       /* use numbers for movement commands */ 
  • trunk/include/rm.h

    r654 r738  
    226226 
    227227extern struct symdef defsyms[MAXPCHARS];        /* defaults */ 
    228 extern uchar showsyms[MAXPCHARS]; 
     228extern glyph_t showsyms[MAXPCHARS]; 
    229229extern const struct symdef def_warnsyms[WARNCOUNT]; 
    230230 
     
    236236#define DEC_GRAPHICS    2       /* VT100 line drawing characters */ 
    237237#define MAC_GRAPHICS    3       /* Macintosh drawing characters */ 
    238 #define CURS_GRAPHICS   4   /* Portable curses drawing characters */ 
     238#define CURS_GRAPHICS   4       /* Portable curses drawing characters */ 
     239#define UTF8_GRAPHICS   5       /* UTF8 characters */ 
    239240 
    240241/* 
  • trunk/src/drawing.c

    r522 r738  
    1919#define g_FILLER(symbol) 0 
    2020 
    21 uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object  display symbols */ 
    22 uchar showsyms[MAXPCHARS] = DUMMY; /* the current feature display symbols */ 
    23 uchar monsyms[MAXMCLASSES] = DUMMY; /* the current monster display symbols */ 
    24 uchar warnsyms[WARNCOUNT]  = DUMMY;  /* the current warning display symbols */ 
     21uchar oc_syms[MAXOCLASSES]  = DUMMY; /* the current object  display symbols */ 
     22glyph_t showsyms[MAXPCHARS] = DUMMY; /* the current feature display symbols */ 
     23uchar monsyms[MAXMCLASSES]  = DUMMY; /* the current monster display symbols */ 
     24uchar warnsyms[WARNCOUNT]   = DUMMY;  /* the current warning display symbols */ 
    2525 
    2626/* Default object class symbols.  See objclass.h. */ 
     
    319319#endif 
    320320 
    321 static uchar ibm_graphics[MAXPCHARS] = { 
     321static glyph_t ibm_graphics[MAXPCHARS] = { 
    322322/* 0*/  g_FILLER(S_stone), 
    323323        0xb3,   /* S_vwall:     meta-3, vertical rule */ 
     
    419419void NDECL((*decgraphics_mode_callback)) = 0;  /* set in tty_start_screen() */ 
    420420 
    421 static uchar dec_graphics[MAXPCHARS] = { 
     421static glyph_t dec_graphics[MAXPCHARS] = { 
    422422/* 0*/  g_FILLER(S_stone), 
    423423        0xf8,   /* S_vwall:     meta-x, vertical rule */ 
     
    517517 
    518518#ifdef MAC_GRAPHICS_ENV 
    519 static uchar mac_graphics[MAXPCHARS] = { 
     519static glyph_t mac_graphics[MAXPCHARS] = { 
    520520/* 0*/  g_FILLER(S_stone), 
    521521        0xba,   /* S_vwall */ 
     
    614614#endif  /* MAC_GRAPHICS_ENV */ 
    615615 
     616#ifdef UTF8_GLYPHS 
     617/* Probably best to only use characters from this list 
     618 * http://en.wikipedia.org/wiki/WGL4 */ 
     619static glyph_t utf8_graphics[MAXPCHARS] = { 
     620/* 0*/  g_FILLER(S_stone), 
     621        0x2502, /* S_vwall:     BOX DRAWINGS LIGHT VERTICAL */ 
     622        0x2500, /* S_hwall:     BOX DRAWINGS LIGHT HORIZONTAL */ 
     623        0x250c, /* S_tlcorn:    BOX DRAWINGS LIGHT DOWN AND RIGHT */ 
     624        0x2510, /* S_trcorn:    BOX DRAWINGS LIGHT DOWN AND LEFT */ 
     625        0x2514, /* S_blcorn:    BOX DRAWINGS LIGHT UP AND RIGHT */ 
     626        0x2518, /* S_brcorn:    BOX DRAWINGS LIGHT UP AND LEFT */ 
     627        0x253c, /* S_crwall:    BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ 
     628        0x2534, /* S_tuwall:    BOX DRAWINGS LIGHT UP AND HORIZONTAL */ 
     629        0x252c, /* S_tdwall:    BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ 
     630        0x2524, /* S_tlwall:    BOX DRAWINGS LIGHT VERTICAL AND LEFT */ 
     631        0x251c, /* S_trwall:    BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ 
     632        0x00b7, /* S_ndoor:     MIDDLE DOT */ 
     633        0x2592, /* S_vodoor:    MEDIUM SHADE */ 
     634        0x2592, /* S_hodoor:    MEDIUM SHADE */ 
     635        g_FILLER(S_vcdoor), 
     636        g_FILLER(S_hcdoor), 
     637        0x03c0, /* S_bars:      GREEK SMALL LETTER PI */ 
     638        0x03a8, /* S_tree:      GREEK CAPITAL LETTER PSI */ 
     639        0x00b7, /* S_room:      MIDDLE DOT */ 
     640        g_FILLER(S_stone),      /* S_darkroom:  meta-~, centered dot */ 
     641        g_FILLER(S_corr), 
     642        g_FILLER(S_litcorr), 
     643        g_FILLER(S_upstair), 
     644        g_FILLER(S_dnstair), 
     645        0x2265, /* S_upladder:  GREATER-THAN OR EQUAL TO */ 
     646        0x2264, /* S_dnladder:  LESS-THAN OR EQUAL TO */ 
     647        0x2020, /* S_altar:     DAGGER */ 
     648        0x03A9, /* S_grave:     GREEK CAPITAL LETTER OMEGA */ 
     649        g_FILLER(S_throne), 
     650        g_FILLER(S_sink), 
     651        0x00b6, /* S_fountain:  PILCROW SIGN */ 
     652        0x2248, /* S_pool:      ALMOST EQUAL TO */ 
     653        0x00b7, /* S_ice:       MIDDLE DOT */ 
     654        0x25c6, /* S_lava:      BLACK DIAMOND */ 
     655        0x00b7, /* S_vodbridge: MIDDLE DOT */ 
     656        0x00b7, /* S_hodbridge: MIDDLE DOT */ 
     657        g_FILLER(S_vcdbridge), 
     658        g_FILLER(S_hcdbridge), 
     659        g_FILLER(S_air), 
     660        g_FILLER(S_cloud), 
     661        0x2248, /* S_water:     ALMOST EQUAL TO */ 
     662        g_FILLER(S_arrow_trap), 
     663        g_FILLER(S_dart_trap), 
     664        g_FILLER(S_falling_rock_trap), 
     665        g_FILLER(S_squeaky_board), 
     666        g_FILLER(S_bear_trap), 
     667        g_FILLER(S_land_mine), 
     668        g_FILLER(S_rolling_boulder_trap), 
     669        g_FILLER(S_sleeping_gas_trap), 
     670        g_FILLER(S_rust_trap), 
     671        g_FILLER(S_fire_trap), 
     672        g_FILLER(S_pit), 
     673        g_FILLER(S_spiked_pit), 
     674        g_FILLER(S_hole), 
     675        g_FILLER(S_trap_door), 
     676        g_FILLER(S_teleportation_trap), 
     677        g_FILLER(S_level_teleporter), 
     678        g_FILLER(S_magic_portal), 
     679        0x00A4, /* S_web:       CURRENCY SIGN */ 
     680        g_FILLER(S_statue_trap), 
     681        g_FILLER(S_magic_trap), 
     682        g_FILLER(S_anti_magic_trap), 
     683        g_FILLER(S_polymorph_trap), 
     684        0x58,   /* S_vbeam:     meta-x, vertical rule */ // TODO 
     685        0x51,   /* S_hbeam:     meta-q, horizontal rule */ // TODO 
     686        g_FILLER(S_lslant), 
     687        g_FILLER(S_rslant), 
     688        g_FILLER(S_digbeam), 
     689        g_FILLER(S_flashbeam), 
     690        g_FILLER(S_boomleft), 
     691        g_FILLER(S_boomright), 
     692        g_FILLER(S_ss1), 
     693        g_FILLER(S_ss2), 
     694        g_FILLER(S_ss3), 
     695        g_FILLER(S_ss4), 
     696        g_FILLER(S_sw_tl), 
     697        0x5f,   /* S_sw_tc:     meta-o, high horizontal line */ // TODO 
     698        g_FILLER(S_sw_tr), 
     699        0x58,   /* S_sw_ml:     meta-x, vertical rule */ // TODO 
     700        0x58,   /* S_sw_mr:     meta-x, vertical rule */ // TODO 
     701        g_FILLER(S_sw_bl), 
     702        0x53,   /* S_sw_bc:     meta-s, low horizontal line */ // TODO 
     703        g_FILLER(S_sw_br), 
     704        g_FILLER(S_explode1), 
     705        0x5f,   /* S_explode2:  meta-o, high horizontal line */ // TODO 
     706        g_FILLER(S_explode3), 
     707        0x58,   /* S_explode4:  meta-x, vertical rule */ // TODO 
     708        g_FILLER(S_explode5), 
     709        0x58,   /* S_explode6:  meta-x, vertical rule */ // TODO 
     710        g_FILLER(S_explode7), 
     711        0x53,   /* S_explode8:  meta-s, low horizontal line */ // TODO 
     712        g_FILLER(S_explode9) 
     713}; 
     714#endif 
     715 
    616716#ifdef PC9800 
    617717void NDECL((*ascgraphics_mode_callback)) = 0;   /* set in tty_start_screen() */ 
     
    649749void 
    650750assign_graphics(graph_chars, glth, maxlen, offset) 
    651 register uchar *graph_chars; 
     751register glyph_t *graph_chars; 
    652752int glth, maxlen, offset; 
    653753{ 
     
    663763int gr_set_flag; 
    664764{ 
     765    iflags.IBMgraphics = FALSE; 
     766    iflags.DECgraphics = FALSE; 
     767    iflags.cursesgraphics = FALSE; 
     768    iflags.UTF8graphics = FALSE; 
     769 
    665770    switch (gr_set_flag) { 
    666771        default: 
    667772        case ASCII_GRAPHICS: 
    668             assign_graphics((uchar *)0, 0, MAXPCHARS, 0); 
     773            assign_graphics((glyph_t *)0, 0, MAXPCHARS, 0); 
    669774#ifdef PC9800 
    670775            if (ascgraphics_mode_callback) (*ascgraphics_mode_callback)(); 
     
    712817#ifdef CURSES_GRAPHICS 
    713818    case CURS_GRAPHICS: 
    714             assign_graphics((uchar *)0, 0, MAXPCHARS, 0); 
     819            assign_graphics((glyph_t *)0, 0, MAXPCHARS, 0); 
    715820        iflags.cursesgraphics = TRUE; 
    716821            iflags.IBMgraphics = FALSE; 
     
    718823        break; 
    719824#endif 
     825#ifdef UTF8_GLYPHS 
     826        case UTF8_GRAPHICS: 
     827            assign_graphics(utf8_graphics, SIZE(utf8_graphics), MAXPCHARS, 0); 
     828            iflags.UTF8graphics = TRUE; 
     829            break; 
     830#endif 
    720831        } 
    721832    return; 
     
    728839 * saved display symbols for objects & features. 
    729840 */ 
    730 static uchar save_oc_syms[MAXOCLASSES] = DUMMY; 
    731 static uchar save_showsyms[MAXPCHARS] = DUMMY; 
    732 static uchar save_monsyms[MAXPCHARS]   = DUMMY; 
    733  
    734 static const uchar r_oc_syms[MAXOCLASSES] = { 
     841static uchar save_oc_syms[MAXOCLASSES]  = DUMMY; 
     842static glyph_t save_showsyms[MAXPCHARS] = DUMMY; 
     843static uchar save_monsyms[MAXPCHARS]    = DUMMY; 
     844 
     845static const glyph_t r_oc_syms[MAXOCLASSES] = { 
    735846/* 0*/  '\0', 
    736847        ILLOBJ_SYM, 
  • trunk/src/mapglyph.c

    r715 r738  
    6464mapglyph(glyph, ochar, ocolor, ospecial, x, y) 
    6565int glyph, *ocolor, x, y; 
    66 int *ochar; 
     66glyph_t *ochar; 
    6767unsigned *ospecial; 
    6868{ 
     
    7171        int color = NO_COLOR; 
    7272#endif 
    73         uchar ch; 
     73        glyph_t ch; 
    7474        unsigned special = 0; 
    7575 
     
    9090    } else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) {   /* swallow */ 
    9191        /* see swallow_to_glyph() in display.c */ 
    92         ch = (uchar) showsyms[S_sw_tl + (offset & 0x7)]; 
     92        ch = showsyms[S_sw_tl + (offset & 0x7)]; 
    9393#ifdef ROGUE_COLOR 
    9494        if (HAS_ROGUE_IBM_GRAPHICS && iflags.use_color) 
     
    248248#endif 
    249249 
    250     *ochar = (int)ch; 
     250    *ochar = ch; 
    251251    *ospecial = special; 
    252252#ifdef TEXTCOLOR 
  • trunk/src/options.c

    r734 r738  
    252252        {"toptenwin",&flags.toptenwin, FALSE, SET_IN_GAME}, 
    253253        {"travel", &iflags.travelcmd, TRUE, SET_IN_GAME}, 
     254#ifdef UTF8_GLYPHS 
     255        {"UTF8graphics", &iflags.UTF8graphics, FALSE, SET_IN_GAME}, 
     256#else 
     257        {"UTF8graphics", (boolean *)0, FALSE, SET_IN_FILE}, 
     258#endif 
    254259        {"use_inverse",   &iflags.wc_inverse, TRUE, SET_IN_GAME},               /*WC*/ 
    255260#ifdef WIN_EDGE 
     
    920925int maxlen, offset; 
    921926{ 
    922         uchar translate[MAXPCHARS+1]; 
     927        glyph_t translate[MAXPCHARS+1]; 
    923928        int length, i; 
    924929 
     
    931936        /* match the form obtained from PC configuration files */ 
    932937        for (i = 0; i < length; i++) 
    933                 translate[i] = (uchar) opts[i]; 
     938                translate[i] = (glyph_t) opts[i]; 
    934939        assign_graphics(translate, length, maxlen, offset); 
    935940} 
     
    28422847                                 || (boolopt[i].addr) == &iflags.cursesgraphics 
    28432848# endif 
     2849# ifdef UTF8_GLYPHS 
     2850                                 || (boolopt[i].addr) == &iflags.UTF8graphics 
     2851# endif 
    28442852                                ) { 
    28452853# ifdef REINCARNATION 
     
    28672875                                switch_graphics(iflags.cursesgraphics ? 
    28682876                                                CURS_GRAPHICS : ASCII_GRAPHICS); 
     2877# endif 
     2878# ifdef UTF8_GLYPHS 
     2879                            if ((boolopt[i].addr) == &iflags.UTF8graphics) 
     2880                                switch_graphics(iflags.UTF8graphics ? 
     2881                                                UTF8_GRAPHICS : ASCII_GRAPHICS); 
    28692882# endif 
    28702883# ifdef REINCARNATION 
  • trunk/src/unicode.c

    r736 r738  
    77/** CP437 to Unicode mapping according to the Unicode Consortium 
    88 * http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT */ 
    9 static int cp437_to_unicode[] = { 
     9static glyph_t cp437_to_unicode[] = { 
    1010        0x00c7, /* LATIN CAPITAL LETTER C WITH CEDILLA */ 
    1111        0x00fc, /* LATIN SMALL LETTER U WITH DIAERESIS */ 
     
    141141 * Only the last 32 characters are significantly different from ASCII 
    142142 * http://support.attachmate.com/techdocs/1184.html */ 
    143 static int dec_graphics_to_unicode[] = { 
     143static glyph_t dec_graphics_to_unicode[] = { 
    144144        0x25c6, /* BLACK DIAMOND */ 
    145145        0x2592, /* MEDIUM SHADE */ 
     
    177177 
    178178/** Returns unicode codepoint of character according to selected graphics mode. */ 
    179 int 
     179glyph_t 
    180180get_unicode_codepoint(int ch) 
    181181{ 
     
    192192} 
    193193 
     194#ifdef UTF8_GLYPHS 
     195/** Prints a Unicode codepoint as UTF-8 encoded byte sequence. 
     196 * Originally from Ray Chason's Unicode proof of concept patch. */ 
     197int 
     198pututf8char(glyph_t c) 
     199{ 
     200  if (c < 0x80) { 
     201    putchar(c); 
     202  } else if(c < 0x800) { 
     203    putchar(0xC0 | (c>>6)); 
     204    putchar(0x80 | (c & 0x3F)); 
     205  } else if (c < 0x10000) { 
     206    putchar(0xE0 | (c>>12)); 
     207    putchar(0x80 | (c>>6 & 0x3F)); 
     208    putchar(0x80 | (c & 0x3F)); 
     209  } else if (c < 0x200000) { 
     210    putchar(0xF0 | (c>>18)); 
     211    putchar(0x80 | (c>>12 & 0x3F)); 
     212    putchar(0x80 | (c>>6 & 0x3F)); 
     213    putchar(0x80 | (c & 0x3F)); 
     214  } 
     215 
     216  return 0; 
     217} 
     218#endif 
     219 
    194220/*unicode.c*/ 
  • trunk/sys/autoconf/autoconf.hin

    r597 r738  
    222222#undef SINKS 
    223223 
     224/* The size of `unsigned int', as computed by sizeof. */ 
     225#undef SIZEOF_UNSIGNED_INT 
     226 
     227/* The size of `unsigned long', as computed by sizeof. */ 
     228#undef SIZEOF_UNSIGNED_LONG 
     229 
     230/* The size of `unsigned long long', as computed by sizeof. */ 
     231#undef SIZEOF_UNSIGNED_LONG_LONG 
     232 
    224233/* TTY graphics status color */ 
    225234#undef STATUS_COLORS 
     
    251260/* Using Mersenne Twister as RNG */ 
    252261#undef USE_MERSENNE_TWISTER 
     262 
     263/* Enable UTF-8 glyphs in TTY */ 
     264#undef UTF8_GLYPHS 
    253265 
    254266/* Fancy mazes */ 
     
    274286#undef YYTEXT_POINTER 
    275287 
     288/* If not already defined, then define as a datatype of *exactly* 32 bits. */ 
     289#undef uint32_t 
     290 
    276291#endif /* AUTOCONF_H */ 
  • trunk/sys/autoconf/configure.ac

    r677 r738  
    112112     *linux* )          AC_DEFINE(LINUX,[],[GNU Linux]);; 
    113113esac 
    114  
    115114 
    116115dnl  ----- Check for programs 
     
    346345AC_CHECK_FUNCS(fcntl) 
    347346 
     347dnl ------ Check for 32 bit datatype 
     348AX_DEFINE_INTEGER_BITS(uint32_t, unsigned int, unsigned long, unsigned long long) 
     349 
    348350dnl  ----- Check for program needed to build Guidebook 
    349351AC_CHECK_PROG(HAVE_NROFF, nroff, "yes", "no") 
     
    460462fi 
    461463 
     464if test "$enable_tty_graphics" != "no"; then 
     465        NETHACK_ARG(utf8-glyphs,[Enable UTF-8 glyphs in TTY],UTF8_GLYPHS,yes) 
     466        if test "$enable_utf8_glyphs" != "no" ; then 
     467                dnl check for uint32_t 
     468                if test "$uint32_t" = no; then 
     469                        AC_MSG_ERROR([unable to continue without a 4-bytes datatype that could hold unicode codepoints]) 
     470                fi 
     471        fi 
     472fi 
     473 
     474 
    462475NETHACK_ARG_WITH_PARAM(whereis-file,[Log information about running games],WHEREIS_FILE,no,FILE,[%n.whereis]) 
    463476 
  • trunk/util/makedefs.c

    r687 r738  
    785785#ifdef TOURIST 
    786786                "tourists", 
     787#endif 
     788#ifdef TOURIST 
     789                "UTF-8 glyphs", 
    787790#endif 
    788791#ifdef USER_SOUNDS 
  • trunk/win/tty/wintty.c

    r709 r738  
    18321832    case NHW_BASE: 
    18331833        tty_curs(window, x, y); 
     1834#ifdef UTF8_GLYPHS 
     1835        if (iflags.UTF8graphics) { 
     1836                pututf8char(ch); 
     1837        } else { 
     1838                (void) putchar(ch); 
     1839        } 
     1840#else 
    18341841        (void) putchar(ch); 
     1842#endif 
    18351843        ttyDisplay->curx++; 
    18361844        cw->curx++; 
     
    25862594    else 
    25872595#endif 
     2596#ifdef UTF8_GLYPHS 
     2597        if (iflags.UTF8graphics) { 
     2598                pututf8char(ch); 
     2599        } else { 
     2600                g_putch(ch);    /* print the character */ 
     2601        } 
     2602#else 
    25882603        g_putch(ch);            /* print the character */ 
     2604#endif 
    25892605 
    25902606    if (reverse_on) {