*** empty log message ***
authorpcg <pcg>
Sat, 6 Mar 2004 00:05:00 +0000 (00:05 +0000)
committerpcg <pcg>
Sat, 6 Mar 2004 00:05:00 +0000 (00:05 +0000)
autoconf/configure.in
configure
src/defaultfont.h
src/init.h
src/main.C
src/menubar.C
src/misc.C
src/ptytty.C
src/rxvt.h
src/rxvtlib.h.in

index 6c1ef814c357296bbd84916fe62a0e1e054b5311..001bb9f912b9939180a064e23d8120067480ec3e 100644 (file)
@@ -1060,7 +1060,7 @@ LIBS=$ac_save_LIBS
 CFLAGS=$ac_save_CFLAGS
 
 AC_CACHE_CHECK(for working plain setlocale, rxvt_cv_func_setlocale,
-[AC_TRY_LINK([#include <locale.h>],
+[AC_TRY_LINK([#include <clocale>],
   [setlocale(LC_CTYPE, "");],
   rxvt_cv_func_setlocale=yes, rxvt_cv_func_setlocale=no)])
 if test x$rxvt_cv_func_setlocale = xyes; then
@@ -1078,7 +1078,7 @@ fi
 AC_CACHE_CHECK(for getpt, rxvt_cv_func_getpt,
 [AC_TRY_LINK([#define _GNU_SOURCE
 #ifdef HAVE_STDLIB_H
-# include <stdlib.h>
+# include <cstdlib>
 #endif],
   [(void)getpt();],
   rxvt_cv_func_getpt=yes, rxvt_cv_func_getpt=no)])
@@ -1307,10 +1307,10 @@ fi dnl
 AC_SUBST($1)])
 
 RXVT_DEFINE_TO_INCLUDE(include_stdint_h, stdint.h, ac_cv_header_stdint_h, yes, notset, dontmatch)
-RXVT_DEFINE_TO_INCLUDE(include_stdarg_h, stdarg.h, ac_cv_header_stdarg_h, yes, notset, dontmatch)
-RXVT_DEFINE_TO_INCLUDE(include_stdlib_h, stdlib.h, ac_cv_header_stdlib_h, yes, notset, dontmatch)
+RXVT_DEFINE_TO_INCLUDE(include_stdarg_h, cstdarg, ac_cv_header_stdarg_h, yes, notset, dontmatch)
+RXVT_DEFINE_TO_INCLUDE(include_stdlib_h, cstdlib, ac_cv_header_stdlib_h, yes, notset, dontmatch)
 RXVT_DEFINE_TO_INCLUDE(include_unistd_h, unistd.h, ac_cv_header_unistd_h, yes, notset, dontmatch)
-RXVT_DEFINE_TO_INCLUDE(include_string_h, string.h, ac_cv_header_string_h, yes, notset, dontmatch)
+RXVT_DEFINE_TO_INCLUDE(include_string_h, cstring, ac_cv_header_string_h, yes, notset, dontmatch)
 RXVT_DEFINE_TO_INCLUDE(include_fcntl_h, fcntl.h, ac_cv_header_fcntl_h, yes, notset, dontmatch)
 RXVT_DEFINE_TO_INCLUDE(include_util_h, util.h, ac_cv_header_util_h, yes, notset, dontmatch)
 RXVT_DEFINE_TO_INCLUDE(include_assert_h, assert.h, ac_cv_header_assert_h, yes, notset, dontmatch)
index 7140f663da38f46fd8fa483f59b654288d41ae0e..909ecc5844e908b714dc44f0495645933d4bb3ad 100755 (executable)
--- a/configure
+++ b/configure
@@ -1031,6 +1031,7 @@ Optional Features:
                      NOTE: this option is order dependent
                      NOTE: automatically enabled with --enable-shared
   --enable-unicode3       use 21 instead of 16 bits to represent unicode characters
+  --enable-combining      enable composition of base and combining characters
   --enable-xft            enable xft support on systems that have it
   --enable-utmp           enable utmp (utmpx) support
   --enable-wtmp           enable wtmp (wtmpx) support (requires --enable-utmp)
@@ -1077,7 +1078,7 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects default=use both
   --with-codesets=NAME,.. compile in additional codesets (jp,jp_ext,kr,cn,cn_ext,all)
   --with-res-name=NAME    use this as default resource name (default: urxvt)
-  --with-res-class=NAME   use this as the resource class (default: URxvt)
+  --with-res-class=CLASS  use this as the resource class (default: URxvt)
   --with-name=NAME        set the basename for the installed binaries (default: urxvt)
   --with-term=NAME        set the terminal to NAME (default: rxvt)
   --with-terminfo=PATH    set the path to the terminfo tree to PATH
@@ -5036,7 +5037,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 case "$host" in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5039 "configure"' > conftest.$ac_ext
+  echo '#line 5040 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5587,7 +5588,7 @@ chmod -w .
 save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
 compiler_c_o=no
-if { (eval echo configure:5590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
+if { (eval echo configure:5591: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
   # The compiler can only warn and ignore the option if not recognized
   # So say no if there are warnings
   if test -s out/conftest.err; then
@@ -7203,7 +7204,7 @@ else
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 7206 "configure"
+#line 7207 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -7301,7 +7302,7 @@ else
     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 7304 "configure"
+#line 7305 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8054,6 +8055,7 @@ support_xim=no
 support_xpm=no
 support_xft=no
 support_unicode3=no
+support_combining=no
 codesets=
 
 
@@ -8095,6 +8097,7 @@ if test "${enable_everything+set}" = set; then
     support_xpm=yes
     support_xft=yes
     support_unicode3=yes
+    support_combining=yes
     codesets=all
   fi
 fi;
@@ -8107,6 +8110,14 @@ if test "${enable_unicode3+set}" = set; then
   fi
 fi;
 
+# Check whether --enable-combining or --disable-combining was given.
+if test "${enable_combining+set}" = set; then
+  enableval="$enable_combining"
+  if test x$enableval = xyes -o x$enableval = xno; then
+    support_combining=yes
+  fi
+fi;
+
 # Check whether --enable-xft or --disable-xft was given.
 if test "${enable_xft+set}" = set; then
   enableval="$enable_xft"
@@ -15861,7 +15872,7 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <locale.h>
+#include <clocale>
 int
 main ()
 {
@@ -15985,7 +15996,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _GNU_SOURCE
 #ifdef HAVE_STDLIB_H
-# include <stdlib.h>
+# include <cstdlib>
 #endif
 int
 main ()
@@ -16394,9 +16405,16 @@ cat >>confdefs.h <<\_ACEOF
 #define UNICODE_3 1
 _ACEOF
 
+fi
+if test x$support_combining = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define ENCODING_COMPOSE 1
+_ACEOF
+
 fi
 if test x$codesets = xall; then
-  codesets=jp,jp-ext,kr,cn,cn-ext,vn
+  codesets=jp,jp-ext,kr,cn,cn-ext
 fi
 for codeset in `echo $codesets | tr "a-z,\\-" "A-Z _"`; do
 
@@ -16496,14 +16514,14 @@ else
   include_stdint_h="/* #include <stdint.h> */"
 fi
 if test "$ac_cv_header_stdarg_h" = "yes" -o "$notset" = "dontmatch"; then
-  include_stdarg_h="#include <stdarg.h>"
+  include_stdarg_h="#include <cstdarg>"
 else
-  include_stdarg_h="/* #include <stdarg.h> */"
+  include_stdarg_h="/* #include <cstdarg> */"
 fi
 if test "$ac_cv_header_stdlib_h" = "yes" -o "$notset" = "dontmatch"; then
-  include_stdlib_h="#include <stdlib.h>"
+  include_stdlib_h="#include <cstdlib>"
 else
-  include_stdlib_h="/* #include <stdlib.h> */"
+  include_stdlib_h="/* #include <cstdlib> */"
 fi
 if test "$ac_cv_header_unistd_h" = "yes" -o "$notset" = "dontmatch"; then
   include_unistd_h="#include <unistd.h>"
@@ -16511,9 +16529,9 @@ else
   include_unistd_h="/* #include <unistd.h> */"
 fi
 if test "$ac_cv_header_string_h" = "yes" -o "$notset" = "dontmatch"; then
-  include_string_h="#include <string.h>"
+  include_string_h="#include <cstring>"
 else
-  include_string_h="/* #include <string.h> */"
+  include_string_h="/* #include <cstring> */"
 fi
 if test "$ac_cv_header_fcntl_h" = "yes" -o "$notset" = "dontmatch"; then
   include_fcntl_h="#include <fcntl.h>"
@@ -18028,13 +18046,17 @@ else
 "
 fi
 if test x$term != x; then
-  echo "  set TERM to:                $term
-"
+  echo "  set TERM to:                $term"
 fi
 if test x$terminfo != x; then
-  echo "  set TERMINFO to:            $terminfo
-"
+  echo "  set TERMINFO to:            $terminfo"
+fi
+echo "  default resource name:      $RESNAME"
+echo "  resource class:             $RESCLASS"
+if test x$RESFALLBACK != x; then
+   echo "  resource class fallback:    $RESFALLBACK"
 fi
+echo
 if test x$rxvt_cv_ptys = xUNKNOWN; then
   echo ".----------------------------------------------------------------."
   echo ". WARNING: could not determine pty/tty type.  Do not build until ."
index f588c60fdec48227da76867d00761c7a2aa29f02..7cdc75656f887bf0f06c0466fb4810822f25d0f4 100644 (file)
@@ -11,7 +11,7 @@
 # include <X11/Xlocale.h>
 #else
 # ifdef HAVE_SETLOCALE
-#  include <locale.h>
+#  include <clocale>
 # endif
 #endif                         /* HAVE_XLOCALE */
 
index 7d5b63cd6dc3e945c4cf317e7bc0f4e2a9d03853..e57ef594eac5194fbcfe71d08903155409e81336 100644 (file)
@@ -9,7 +9,7 @@
 # include <X11/Xlocale.h>
 #else
 # ifdef HAVE_SETLOCALE
-#  include <locale.h>
+#  include <clocale>
 # endif
 #endif                         /* HAVE_XLOCALE */
 
index 7ab5dd5d202ccd2b01e2570e208b62cfead966bb..b38c4b6bc3b4acaad34d8a4961c637c0f680251c 100644 (file)
@@ -58,6 +58,69 @@ rxvt_set_locale (const char *locale)
     }
 }
 
+class rxvt_composite_vec rxvt_composite;
+
+text_t rxvt_composite_vec::compose (uint32_t c1, uint32_t c2)
+{
+  compose_char *cc;
+  
+  // break compose chains, as stupid readline really likes to duplicate
+  // composing characters for some reason near the end of a line.
+  cc = (*this)[c1];
+  while (cc)
+    {
+      if (cc->c2 == c2) return c1;
+      cc = (*this)[cc->c1];
+    }
+
+  // check to see wether this combination already exists otherwise
+  for (cc = v.end (); cc-- > v.begin (); )
+    {
+      if (cc->c1 == c1 && cc->c2 == c2)
+        return COMPOSE_LO + (cc - v.begin ());
+    }
+
+  // allocate a new combination
+  if (v.size () == COMPOSE_HI - COMPOSE_LO + 1)
+    {
+      static int seen;
+
+      if (!seen++)
+        fprintf (stderr, "too many unrepresentable composite characters, try --enable-unicode3\n");
+
+      return REPLACEMENT_CHAR;
+    }
+
+  v.push_back (compose_char (c1, c2));
+
+  return v.size () - 1 + COMPOSE_LO;
+}
+
+int rxvt_composite_vec::expand (uint32_t c, wchar_t *r)
+{
+  compose_char *cc = (*this)[c];
+
+  if (!cc)
+    {
+      if (r) *r = c;
+      return 1;
+    }
+
+  int len = expand (cc->c1, r);
+
+  if (r) r += len;
+
+  if (cc->c2 != NOCHAR)
+    {
+      len++;
+      if (r) *r++ = cc->c2;
+    }
+
+  return len;
+
+}
+
+extern struct rxvt_composite_vec rxvt_composite;
 void *
 rxvt_term::operator new (size_t s)
 {
index 8064ab46e6747ad569913e2ba6a3d175fd0eb1c7..75c95811a1856a98b72830ffb6fafa1c288f0ecc 100644 (file)
@@ -24,8 +24,7 @@
 
 #include "../config.h"         /* NECESSARY */
 
-#include <stdlib.h>
-#include <wchar.h>
+#include <cstdlib>
 
 #include "rxvt.h"              /* NECESSARY */
 #ifdef MENUBAR
index 793cbab76232f5aa9e02a340111c26ff66f6a1fd..3f04220efc4b1a9451b8adeb9c062043e876b851 100644 (file)
 #include "rxvt.h"              /* NECESSARY */
 #include "misc.intpro"         /* PROTOS for internal routines */
 
+/* EXTPROTO */
+char *
+rxvt_wcstombs (const wchar_t *str, int len)
+{
+  mbstate mbs;
+  char *r = (char *)rxvt_malloc (len * MB_CUR_MAX + 1);
+
+  char *dst = r;
+  while (len--)
+    {
+      int l = wcrtomb (dst, *str++, mbs);
+      if (l < 0)
+        *dst++ = '?';
+      else
+        dst += l;
+    }
+
+  *dst++ = 0;
+
+  return r;
+}
+
 /* EXTPROTO */
 char *
 rxvt_strdup (const char *str)
index e982b77dca2a1518f8ccdecd171f17c0ad3a3c77..2ee5b8f131e622f5ba04fcd2b8bdd1643a47bc98 100644 (file)
@@ -32,9 +32,9 @@
 #endif
 #endif
 
-#include <stdio.h>
+#include <cstdio>
 #ifdef HAVE_STDLIB_H
-# include <stdlib.h>
+# include <cstdlib>
 #endif
 #ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
@@ -43,7 +43,7 @@
 # include <unistd.h>
 #endif
 #if defined(HAVE_STRING_H)
-# include <string.h>
+# include <cstring>
 #endif
 #ifdef HAVE_FCNTL_H
 # include <fcntl.h>
index d31f168621795e309aaabb6124cfc493391a1317..33940a6bbf1baf50a3c0c31598fb32840205255b 100644 (file)
@@ -15,8 +15,6 @@
 #include "iom.h"
 #include "salloc.h"
 
-#include <wchar.h>
-
 /*
  *****************************************************************************
  * SYSTEM HACKS
@@ -360,33 +358,34 @@ enum {
   XTerm_name             =  0,
   XTerm_iconName         =  1,
   XTerm_title            =  2,
-  XTerm_property         =  3,      /* change X property, not yet implemented */
-  XTerm_Color            =  4,      /* change colors */
-  XTerm_Color00          = 10,      /* not implemented, CLASH! */
-  XTerm_Color01          = 11,      /* not implemented */
-  XTerm_Color_cursor     = 12,      /* change actual 'Cursor' color */
-  XTerm_Color_pointer    = 13,      /* change actual 'Pointer' color */
-  XTerm_Color04          = 14,      /* not implemented */
-  XTerm_Color05          = 15,      /* not implemented */
-  XTerm_Color06          = 16,      /* not implemented */
-  XTerm_Color_RV         = 17,      /* change actual 'Highlight' color */
-  XTerm_logfile          = 46,      /* not implemented */
+  XTerm_property         =  3,      // change X property, not yet implemented
+  XTerm_Color            =  4,      // change colors
+  XTerm_Color00          = 10,      // not implemented, CLASH!
+  XTerm_Color01          = 11,      // not implemented
+  XTerm_Color_cursor     = 12,      // change actual 'Cursor' color
+  XTerm_Color_pointer    = 13,      // change actual 'Pointer' color
+  XTerm_Color04          = 14,      // not implemented
+  XTerm_Color05          = 15,      // not implemented
+  XTerm_Color06          = 16,      // not implemented
+  XTerm_Color_RV         = 17,      // change actual 'Highlight' color
+  XTerm_logfile          = 46,      // not implemented
   XTerm_font             = 50,
 
-  XTerm_konsole30        = 30,      /* reserved for konsole */
-  XTerm_konsole31        = 31,      /* reserved for konsole */
-  XTerm_emacs51          = 51,      /* reserved for emacs shell */
+  XTerm_konsole30        = 30,      // reserved for konsole
+  XTerm_konsole31        = 31,      // reserved for konsole
+  XTerm_emacs51          = 51,      // reserved for emacs shell
   /*
    * rxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL)
    */
-  XTerm_locale         =  9,      /* change locale */
-  XTerm_Menu             = 10,     /* set menu item */
-  XTerm_Color_BD         = 18,     /* change actual 'Bold' color */
-  XTerm_Color_UL         = 19,     /* change actual 'Underline' color */
-  XTerm_Pixmap           = 20,     /* new bg pixmap */
-  XTerm_restoreFG        = 39,     /* change default fg color */
-  XTerm_restoreBG        = 49,     /* change default bg color */
-  XTerm_dumpscreen       = 55,     /* dump scrollback and all of screen */
+  XTerm_Menu             = 10,      // set menu item
+  XTerm_Color_BD         = 18,      // change actual 'Bold' color
+  XTerm_Color_UL         = 19,      // change actual 'Underline' color
+  XTerm_Pixmap           = 20,      // new bg pixmap
+  XTerm_restoreFG        = 39,      // change default fg color
+  XTerm_restoreBG        = 49,      // change default bg color
+  XTerm_dumpscreen       = 55,      // dump scrollback and all of screen
+  XTerm_locale           = 701,     // change locale
+  XTerm_findfont         = 702,     // find font of given character (in decimal)
 };
 
 /* Words starting with `Color_' are colours.  Others are counts */
@@ -833,8 +832,46 @@ struct mbstate {
   mbstate () { reset (); }
 };
 
+#if UNICODE3
+# define COMPOSE_LO 0x40000000UL
+# define COMPOSE_HI 0x400fffffUL
+# define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO)
+#else
+# define COMPOSE_LO 0xd800UL
+# define COMPOSE_HI 0xf8ffUL // dfff should be safer, but...
+# define IS_COMPOSE(n) (COMPOSE_LO <= (n) && (n) <= COMPOSE_HI)
+#endif
+
+#if ENCODING_COMPOSE
+// compose chars are used to represent composite characters
+// that are not representable in unicode, as well as characters
+// not fitting in the BMP.
+struct compose_char {
+  uint32_t c1, c2; // any chars != NOCHAR are valid
+  compose_char (uint32_t c1, uint32_t c2)
+  : c1(c1), c2(c2)
+  { }
+};
+
+class rxvt_composite_vec {
+  vector<compose_char> v;
+public:
+  text_t compose (uint32_t c1, uint32_t c2 = NOCHAR);
+  int expand (uint32_t c, wchar_t *r);
+  compose_char *operator [](text_t c)
+  {
+    return c >= COMPOSE_LO && c < COMPOSE_LO + v.size ()
+           ? &v[c - COMPOSE_LO]
+           : 0;
+  }
+};
+
+extern class rxvt_composite_vec rxvt_composite;
+#endif
+
+
 struct rxvt_term : rxvt_vars {
-  struct          mbstate mbstate;
+  struct mbstate mbstate;
 
   unsigned char   want_refresh:1,
 #ifdef TRANSPARENT
index dcce4663239844ef99a429d6780eae72980d0930..2d1157cfa43472f3ce2c09835fa583c719f14eea 100644 (file)
@@ -1,9 +1,9 @@
 #ifndef _RXVTLIB_H_             /* include once only */
 #define _RXVTLIB_H_
 
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
+#include <cstdio>
+#include <cctype>
+#include <cerrno>
 @include_stdarg_h@
 @include_stdlib_h@
 @include_stdint_h@
@@ -22,6 +22,8 @@
 #include <sys/wait.h>
 #include <sys/stat.h>
 
+#include <cwchar>
+
 extern "C" {
 #include <X11/Intrinsic.h>      /* Xlib, Xutil, Xresource, Xfuncproto */
 }
@@ -63,7 +65,7 @@ typedef struct {
   int32_t         col;
 } row_col_t;
 
-#if UNICODE3
+#if UNICODE_3
 typedef uint32_t text_t;
 #else
 typedef uint16_t text_t; // saves lots of memory
@@ -159,7 +161,7 @@ enum selection_op_t {
 };
 
 typedef struct {
-  unsigned char  *text;       /* selected text                             */
+  wchar_t        *text;       /* selected text                             */
   uint32_t        len;        /* length of selected text                   */
   short           screen;     /* screen being used                         */
   short           clicks;     /* number of clicks                          */