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
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)])
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)
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)
--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
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=$?
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
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
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
support_xpm=no
support_xft=no
support_unicode3=no
+support_combining=no
codesets=
support_xpm=yes
support_xft=yes
support_unicode3=yes
+ support_combining=yes
codesets=all
fi
fi;
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"
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <locale.h>
+#include <clocale>
int
main ()
{
/* end confdefs.h. */
#define _GNU_SOURCE
#ifdef HAVE_STDLIB_H
-# include <stdlib.h>
+# include <cstdlib>
#endif
int
main ()
#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
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>"
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>"
"
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 ."
# include <X11/Xlocale.h>
#else
# ifdef HAVE_SETLOCALE
-# include <locale.h>
+# include <clocale>
# endif
#endif /* HAVE_XLOCALE */
# include <X11/Xlocale.h>
#else
# ifdef HAVE_SETLOCALE
-# include <locale.h>
+# include <clocale>
# endif
#endif /* HAVE_XLOCALE */
}
}
+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)
{
#include "../config.h" /* NECESSARY */
-#include <stdlib.h>
-#include <wchar.h>
+#include <cstdlib>
#include "rxvt.h" /* NECESSARY */
#ifdef MENUBAR
#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)
#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>
# include <unistd.h>
#endif
#if defined(HAVE_STRING_H)
-# include <string.h>
+# include <cstring>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#include "iom.h"
#include "salloc.h"
-#include <wchar.h>
-
/*
*****************************************************************************
* SYSTEM HACKS
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 */
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
#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@
#include <sys/wait.h>
#include <sys/stat.h>
+#include <cwchar>
+
extern "C" {
#include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */
}
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
};
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 */