summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorroot <root>2014-05-22 18:54:32 +0000
committerroot <root>2014-05-22 18:54:32 +0000
commit8c0b328bbc429059a2b9462c9b5dcbbeb0d173e7 (patch)
tree62bb6b5e2df951b7ca51628c2caa6e5c698e00b5 /src
parentfe72076284de7d79d15549fb36499bd5ee0f4ee8 (diff)
GPLv3
Diffstat (limited to 'src')
-rw-r--r--src/callback.h420
-rw-r--r--src/encoding.C316
-rw-r--r--src/feature.h377
-rw-r--r--src/perl/bell-command51
-rw-r--r--src/rxvt.C46
-rw-r--r--src/rxvttoolkit.h414
-rw-r--r--src/scrollbar-plain.C71
-rw-r--r--src/scrollbar-rxvt.C222
-rw-r--r--src/scrollbar-xterm.C89
-rw-r--r--src/scrollbar.C285
10 files changed, 2291 insertions, 0 deletions
diff --git a/src/callback.h b/src/callback.h
new file mode 100644
index 0000000..1b04e56
--- /dev/null
+++ b/src/callback.h
@@ -0,0 +1,420 @@
+// THIS IS A GENERATED FILE: RUN callback.pl to regenerate it
+// THIS IS A GENERATED FILE: callback.pl is part of the GVPE
+// THIS IS A GENERATED FILE: distribution.
+
+/*
+ callback.h -- C++ callback mechanism
+ Copyright (C) 2003-2007 Marc Lehmann <schmorp@schmorp.de>
+
+ This file is part of GVPE.
+
+ GVPE is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with gvpe; if not, write to the Free Software
+ Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef CALLBACK_H__
+#define CALLBACK_H__
+
+#define CALLBACK_H_VERSION 3
+
+template<typename signature>
+struct callback;
+
+template<class R>
+struct callback<R ()>
+{
+ typedef R (*ptr_type)(void *self);
+
+ template<class K, R (K::*method)()>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call () const
+ {
+ return func (self);
+ }
+
+ R operator ()() const
+ {
+ return call ();
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)()>
+ static R thunk (void *self)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) ();
+ }
+};
+
+template<class R, class A1>
+struct callback<R (A1)>
+{
+ typedef R (*ptr_type)(void *self, A1);
+
+ template<class K, R (K::*method)(A1)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1) const
+ {
+ return func (self, a1);
+ }
+
+ R operator ()(A1 a1) const
+ {
+ return call (a1);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1)>
+ static R thunk (void *self, A1 a1)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1);
+ }
+};
+
+template<class R, class A1, class A2>
+struct callback<R (A1, A2)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2);
+
+ template<class K, R (K::*method)(A1, A2)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2) const
+ {
+ return func (self, a1, a2);
+ }
+
+ R operator ()(A1 a1, A2 a2) const
+ {
+ return call (a1, a2);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2)>
+ static R thunk (void *self, A1 a1, A2 a2)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2);
+ }
+};
+
+template<class R, class A1, class A2, class A3>
+struct callback<R (A1, A2, A3)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3);
+
+ template<class K, R (K::*method)(A1, A2, A3)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3) const
+ {
+ return func (self, a1, a2, a3);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3) const
+ {
+ return call (a1, a2, a3);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4>
+struct callback<R (A1, A2, A3, A4)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ return func (self, a1, a2, a3, a4);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const
+ {
+ return call (a1, a2, a3, a4);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4, class A5>
+struct callback<R (A1, A2, A3, A4, A5)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4, A5)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ return func (self, a1, a2, a3, a4, a5);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ {
+ return call (a1, a2, a3, a4, a5);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4, A5)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4, a5);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4, class A5, class A6>
+struct callback<R (A1, A2, A3, A4, A5, A6)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ return func (self, a1, a2, a3, a4, a5, a6);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ {
+ return call (a1, a2, a3, a4, a5, a6);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4, a5, a6);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
+struct callback<R (A1, A2, A3, A4, A5, A6, A7)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ return func (self, a1, a2, a3, a4, a5, a6, a7);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ {
+ return call (a1, a2, a3, a4, a5, a6, a7);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4, a5, a6, a7);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
+struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ return func (self, a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
+ {
+ return call (a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
+struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8, A9)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
+ {
+ return func (self, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
+ {
+ return call (a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ }
+};
+
+template<class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
+struct callback<R (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
+{
+ typedef R (*ptr_type)(void *self, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
+
+ template<class K, R (K::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
+ void set (K *object)
+ {
+ self = object;
+ func = thunk<K, method>;
+ }
+
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
+ {
+ return func (self, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+ }
+
+ R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
+ {
+ return call (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+ }
+
+private:
+
+ void *self;
+ ptr_type func;
+
+ template<class klass, R (klass::*method)(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)>
+ static R thunk (void *self, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10)
+ {
+ klass *obj = static_cast<klass *>(self);
+ return (obj->*method) (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+ }
+};
+
+
+#endif
diff --git a/src/encoding.C b/src/encoding.C
new file mode 100644
index 0000000..0b6d593
--- /dev/null
+++ b/src/encoding.C
@@ -0,0 +1,316 @@
+/*----------------------------------------------------------------------*
+ * File: encoding.C
+ *----------------------------------------------------------------------*
+ *
+ * All portions of code are copyright by their respective author/s.
+ * Copyright (c) 2003-2006 Marc Lehmann <schmorp@schmorp.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *----------------------------------------------------------------------*/
+
+#include "../config.h"
+
+#include "encoding.h"
+#include "rxvtutil.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+static const struct n2cs {
+ const char *name;
+ codeset cs;
+} n2cs[] = {
+ /* first one found is the normalized one */
+ { "ISO88591", CS_ISO8859_1 },
+ { "ISO8859PRIMARY", CS_ISO8859_1 }, // some stupid fonts use this (hi tigert)
+ { "ISO88592", CS_ISO8859_2 },
+ { "ISO88593", CS_ISO8859_3 },
+ { "ISO88594", CS_ISO8859_4 },
+ { "ISO88595", CS_ISO8859_5 },
+ { "ISO88596", CS_ISO8859_6 },
+ { "ISO88597", CS_ISO8859_7 },
+ { "ISO88598", CS_ISO8859_8 },
+ { "ISO88599", CS_ISO8859_9 },
+ { "ISO885910", CS_ISO8859_10 },
+ { "ISO885911", CS_ISO8859_11 },
+ { "ISO885913", CS_ISO8859_13 },
+ { "ISO885914", CS_ISO8859_14 },
+ { "ISO885915", CS_ISO8859_15 },
+ { "FCD885915", CS_ISO8859_15 },
+ { "ISO885916", CS_ISO8859_16 },
+
+ { "TIS620*", CS_ISO8859_11 }, // close enough
+
+ { "ISO10646*", CS_UNICODE },
+ { "UNICODE", CS_UNICODE },
+ { "UTF8", CS_UNICODE },
+
+ { "ASCII", CS_US_ASCII },
+ { "USASCII", CS_US_ASCII },
+ { "ANSIX341968", CS_US_ASCII },
+ { "ISO6461991IRV", CS_US_ASCII }, // older versions used the currency sign
+
+ { "KOI8R*", CS_KOI8_R },
+ { "GOST1976874*", CS_KOI8_R },
+ { "KOI8RU", CS_KOI8_U },
+ { "KOI8U", CS_KOI8_U },
+
+ { "VISCII*", CS_VISCII },
+
+ { "JISX0201*", CS_JIS0201_1976_0 },
+ { "JISC6226*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP)
+ { "JISX0208*", CS_JIS0208_1990_0 }, // also wrongly matches -1987-0? (check Encode::JP)
+ { "JISX0212*", CS_JIS0212_1990_0 },
+ { "JISX021320001", CS_JIS0213_1 },
+ { "JISX021320002", CS_JIS0213_2 },
+ { "JISX0221*", CS_UNICODE }, // _very_ close
+
+ { "KSC5601*", CS_KSC5601_1987_0 },
+ { "KSX1001*", CS_KSC5601_1987_0 },
+ { "KSC5700*", CS_UNICODE }, // unicode plus extensions
+
+ { "BIG5P*", CS_BIG5_PLUS },
+ { "BIG5ETEN*", CS_BIG5_EXT },
+ { "BIG5*", CS_BIG5 },
+ { "GB2312*", CS_GB2312_1980_0 },
+ { "GBK*", CS_GBK_0 },
+ { "GB6345*", CS_GB2312_1980_0 }, // slightly different to gb2312??
+ { "GB8565*", CS_GB2312_1980_0 }, // a superset of gb2312??
+ { "GB13000*", CS_UNICODE },
+ { "CNS1164319921", CS_CNS11643_1992_1 },
+ { "CNS1164319922", CS_CNS11643_1992_2 },
+ { "CNS1164319923", CS_CNS11643_1992_3 },
+ { "CNS1164319924", CS_CNS11643_1992_4 },
+ { "CNS1164319925", CS_CNS11643_1992_5 },
+ { "CNS1164319926", CS_CNS11643_1992_6 },
+ { "CNS1164319927", CS_CNS11643_1992_7 },
+ { "CNS116431992F", CS_CNS11643_1992_F },
+
+ { 0, CS_UNKNOWN }
+};
+
+static const char *
+normalize_name (const char *name)
+{
+ static char res[16];
+ char *r;
+
+ for (r = res; *name && r < res + 15; name++)
+ if ((*name >= '0' && *name <= '9')
+ || (*name >= 'A' && *name <= 'Z'))
+ *r++ = *name;
+ else if (*name >= 'a' && *name <= 'z')
+ *r++ = *name - ('a' - 'A');
+
+ *r = 0;
+
+ return res;
+}
+
+codeset
+codeset_from_name (const char *name)
+{
+ if (!name)
+ return CS_UNKNOWN;
+
+ name = normalize_name (name);
+
+ const struct n2cs *i = n2cs;
+
+ do {
+ int len = strlen (i->name);
+
+ if ((i->name[len - 1] == '*'
+ && !strncmp (name, i->name, len - 1))
+ || !strcmp (name, i->name))
+ return i->cs;
+
+ } while ((++i)->name);
+
+ return CS_UNKNOWN;
+}
+
+static unicode_t cs_unknown_to_unicode (uint32_t enc) { return NOCHAR; }
+static uint32_t cs_unknown_from_unicode (unicode_t unicode) { return NOCHAR; }
+
+static unicode_t cs_unicode_to_unicode (uint32_t enc) { return enc; }
+static uint32_t cs_unicode_from_unicode (unicode_t unicode) { return unicode; }
+
+#define cs_us_ascii_to_unicode cs_unicode_to_unicode
+static uint32_t cs_us_ascii_from_unicode (unicode_t unicode) { return unicode <= 127 ? unicode : NOCHAR; }
+
+#define cs_us_ascii_to_unicode_16 cs_unicode_to_unicode
+static uint32_t cs_unicode_16_from_unicode (unicode_t unicode) { return unicode <= 65535 ? unicode : NOCHAR; }
+
+#define ENCODING_DEFAULT
+
+#include "table/iso8859_1.h"
+#include "table/iso8859_15.h"
+
+//#define ENCODING_EU
+
+#include "table/iso8859_2.h"
+#include "table/iso8859_3.h"
+#include "table/iso8859_4.h"
+#include "table/iso8859_5.h"
+#include "table/iso8859_6.h"
+#include "table/iso8859_7.h"
+#include "table/iso8859_8.h"
+#include "table/iso8859_9.h"
+#include "table/iso8859_10.h"
+#include "table/iso8859_11.h"
+#include "table/iso8859_13.h"
+#include "table/iso8859_14.h"
+#include "table/iso8859_16.h"
+
+#include "table/koi8_r.h"
+#include "table/koi8_u.h"
+
+//#define ENCODING_KR
+
+#include "table/ksc5601_1987_0.h"
+
+//#define ENCODING_ZH
+
+#include "table/big5.h"
+#include "table/gbk_0.h"
+#include "table/gb2312_1980_0.h"
+
+//#define ENCODING_ZH_EXT
+
+#include "table/cns11643_1992_1.h"
+#include "table/cns11643_1992_2.h"
+#include "table/cns11643_1992_3.h"
+#include "table/cns11643_1992_4.h"
+#include "table/cns11643_1992_5.h"
+#include "table/cns11643_1992_6.h"
+#include "table/cns11643_1992_7.h"
+#include "table/cns11643_1992_f.h"
+#include "table/big5_ext.h"
+#include "table/big5_plus.h"
+
+//#define ENCODING_VN
+
+#include "table/viscii.h"
+
+//#define ENCODING_JP
+
+#include "table/jis0201_1976_0.h"
+#include "table/jis0208_1990_0.h"
+#include "table/jis0212_1990_0.h"
+
+//#define ENCODING_JP_EXT
+
+#include "table/jis0213_1.h"
+#include "table/jis0213_2.h"
+
+#if ENCODING_TO_UNICODE
+# define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode }
+#else
+# define ENC(base) { cs_ ## base ## _from_unicode }
+#endif
+
+
+// order must match table in encoding.h(!)
+const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = {
+ ENC (unknown),
+
+ ENC (us_ascii),
+
+ ENC (iso8859_1),
+ ENC (iso8859_2),
+ ENC (iso8859_3),
+ ENC (iso8859_4),
+ ENC (iso8859_5),
+ ENC (iso8859_6),
+ ENC (iso8859_7),
+ ENC (iso8859_8),
+ ENC (iso8859_9),
+ ENC (iso8859_10),
+ ENC (iso8859_11),
+ ENC (iso8859_13),
+ ENC (iso8859_14),
+ ENC (iso8859_15),
+ ENC (iso8859_16),
+
+ ENC (koi8_r),
+ ENC (koi8_u),
+
+ ENC (jis0201_1976_0),
+ ENC (jis0208_1990_0),
+ ENC (jis0212_1990_0),
+
+ ENC (jis0213_1),
+ ENC (jis0213_2),
+
+ ENC (ksc5601_1987_0),
+
+ ENC (gb2312_1980_0),
+ ENC (gbk_0),
+
+ ENC (cns11643_1992_1),
+ ENC (cns11643_1992_2),
+ ENC (cns11643_1992_3),
+ ENC (cns11643_1992_4),
+ ENC (cns11643_1992_5),
+ ENC (cns11643_1992_6),
+ ENC (cns11643_1992_7),
+ ENC (cns11643_1992_f),
+ ENC (big5),
+ ENC (big5_ext),
+ ENC (big5_plus),
+
+ ENC (viscii),
+
+ ENC (unicode_16),
+ ENC (unicode),
+};
+
+#if ENABLE_COMBINING
+# define ENCODING_COMPOSE
+#endif
+
+#include "table/compose.h"
+
+unicode_t
+rxvt_compose (unicode_t c1, unicode_t c2)
+{
+ int l = 0;
+ int r = ecb_array_length (rxvt_compose_table) - 1;
+ int m;
+
+ while (r >= l)
+ {
+ m = (l + r) / 2;
+ rxvt_compose_entry &c = rxvt_compose_table[m];
+
+ if (c.c1 < c1 || (c.c1 == c1 && c.c2 < c2))
+ l = m + 1;
+ else if (c.c1 > c1 || (c.c1 == c1 && c.c2 > c2))
+ r = m - 1;
+ else
+ return c.r;
+ }
+
+ return NOCHAR;
+}
+
+#include "table/category.h"
+
+bool unicode::is_space (unicode_t c)
+{
+ return IS_SPACE (c)
+ || c == 0x09; // exclude tabs, too, as we store them in the buffer
+}
diff --git a/src/feature.h b/src/feature.h
new file mode 100644
index 0000000..39e080e
--- /dev/null
+++ b/src/feature.h
@@ -0,0 +1,377 @@
+/*
+ * File: feature.h
+ *
+ * Compile-time configuration.
+ *-----------------------------------------------------------------------
+ * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *----------------------------------------------------------------------*/
+#ifndef FEATURE_H
+#define FEATURE_H
+
+#ifndef X11USRLIBDIR
+# define X11USRLIBDIR "/usr/lib"
+#endif
+#ifndef X11LIBDIR
+# define X11LIBDIR X11USRLIBDIR "/X11"
+#endif
+#ifndef XAPPLOADDIR
+# define XAPPLOADDIR X11LIBDIR "/app-defaults"
+# define XAPPLOADDIRLOCALE X11LIBDIR "/%s/app-defaults"
+#endif
+
+/*-----------------------SCREEN OPTIONS AND COLOURS---------------------*/
+
+/*
+ * NOTE:
+ *
+ * Some of these configuration options have not been tested within the new
+ * rxvt-unicode framework. Changing them should work, might have no effect,
+ * destroy your disks or have any other effects. You may freely try (and
+ * report bugs, too!), but don't _expect_ them to work.
+ */
+
+/*
+ * The cursor blink interval, in seconds.
+ */
+#define CURSOR_BLINK_INTERVAL 0.5
+
+/*
+ * The text blink interval, in seconds.
+ */
+#define TEXT_BLINK_INTERVAL CURSOR_BLINK_INTERVAL
+
+/*
+ * Avoid enabling the colour cursor (-cr, cursorColor, cursorColor2)
+ */
+/* #define NO_CURSORCOLOR */
+
+/*
+ * Make colours match xterm colours instead of `traditional' rxvt colours
+ */
+#define XTERM_COLORS
+
+/*
+ * Disable separate colours for bold, underline and reverse video
+ */
+/* #define NO_BOLD_UNDERLINE_REVERSE */
+
+/*
+ * Define maximum possible columns and rows
+ */
+#define MAX_COLS 10000
+#define MAX_ROWS 10000
+
+/*
+ * Define maximum possible savelines
+ */
+#define MAX_SAVELINES 10000000
+
+/*
+ * Define to remove support for XCopyArea () support. XCopyArea () is useful
+ * for scrolling on non-local X displays
+ */
+#define NO_SLOW_LINK_SUPPORT
+
+/*
+ * Allow 80/132 mode switching on startup
+ */
+/* #define ALLOW_132_MODE */
+
+/*---------------------------------KEYS---------------------------------*/
+
+/*
+ * Enable the keysym resource which allows you to define strings associated
+ * with various KeySyms (0xFF00 - 0xFFFF).
+ * Required by perl.
+ */
+#if ENABLE_FRILLS || ENABLE_PERL
+# define KEYSYM_RESOURCE
+#endif
+
+/*
+ * Modifier/s to use to allow up/down arrows and Prior/Next keys
+ * to scroll single or page-fulls
+ */
+#define SCROLL_ON_SHIFT
+/* #define SCROLL_ON_CTRL */
+/* #define SCROLL_ON_META */
+
+/*
+ * Allow scrolling with modifier+Up/Down keys, in addition
+ * to modifier+Prior/Next? (modifier is controlled with
+ * SCROLL_ON_* defines above.).
+ * Also for modifier+Home/End keys to move to top/bottom
+ */
+/* #define SCROLL_ON_UPDOWN_KEYS */
+/* #define SCROLL_ON_HOMEEND_KEYS */
+
+/*
+ * Allow unshifted Next/Prior keys to scroll forward/back
+ * (in addition to shift+Next/shift+Prior) --pjh
+ */
+/* #define UNSHIFTED_SCROLLKEYS */
+
+/* (Hops) Set to choose a number of lines of context between pages
+ * (rather than a proportion (1/5) of savedlines buffer)
+ * when paging the savedlines with SHIFT-{Prior,Next} keys.
+ */
+#define PAGING_CONTEXT_LINES 1
+
+/*
+ * Have either Ctrl+Tab or Mod4+Tab emit \e\t
+ * Useful when window manager grabs Alt+Tab -- mg
+ */
+/* #define CTRL_TAB_MAKES_META */
+/* #define MOD4_TAB_MAKES_META */
+
+/*--------------------------------MOUSE---------------------------------*/
+/*
+ * Disable sending escape sequences (up, down, page up/down)
+ * from the scrollbar when XTerm mouse reporting is enabled
+ */
+/* #define NO_SCROLLBAR_REPORT */
+
+/*
+ * Have mouse reporting include double-click info for button1
+ */
+/* #define MOUSE_REPORT_DOUBLECLICK */
+
+/*
+ * Set delay between multiple click events [default: 500 milliseconds]
+ */
+/* #define MULTICLICK_TIME 500 */
+
+/*
+ * Time factor to slow down a `jumpy' mouse. Motion isn't recognised until
+ * this long after the last mouse click [default: 50 milliseconds]
+ */
+#define MOUSE_THRESHOLD 50
+
+/*
+ * Set delay periods for continuous scrolling with scrollbar buttons
+ */
+/* #define SCROLLBAR_INITIAL_DELAY 0.33 */
+/* #define SCROLLBAR_CONTINUOUS_DELAY 0.05 */
+
+/*
+ * The speed of selection scrolling is proportional to the distance
+ * the mouse pointer is out of the text window. This is the max
+ * number of lines to scroll at a time.
+ */
+#define SELECTION_SCROLL_MAX_LINES 8
+
+/*
+ * The number of lines (measured in character's heights, not pixels)
+ * the pointer must be out of the window for each increase in the
+ * number of lines scrolled.
+ */
+#define SELECTION_SCROLL_LINE_SPEEDUP 3
+
+/*--------------------------------MISC----------------------------------*/
+/*
+ * Only log in wtmp and lastlog files when we're a login shell (-ls option)
+ */
+#define LOG_ONLY_ON_LOGIN
+
+/*--------------------------------BELL----------------------------------*/
+/*
+ * Disable all bell indications
+ */
+/* #define NO_BELL */
+
+/*
+ * Disable automatic de-iconify when a bell is received
+ */
+/* #define NO_MAPALERT */
+
+/*
+ * Have mapAlert behaviour selectable with mapAlert resource
+ */
+#define MAPALERT_OPTION
+
+/*-----------------------------SCROLL BAR-------------------------------*/
+/*
+ * Choose the rxvt style scrollbar width
+ * - should be an even number [default: 10]
+ */
+/* #define SB_WIDTH_RXVT 10 */
+
+/*
+ * Minimum and maximum widths of the scrollbar (all styles)
+ */
+#define SB_WIDTH_MINIMUM 5
+#define SB_WIDTH_MAXIMUM 100
+
+/*
+ * rxvt scrollbar shadow width in pixels, must be 1 or 2
+ */
+#define SHADOW_WIDTH 1
+
+/*
+ * clicking above or below the scrollbar slider (all styles minus
+ * xterm) will scroll by (height - 1) rather than (height / 4).
+ */
+#define RXVT_SCROLL_FULL 1
+
+/*
+ * (Hops) draw an internal border line on inside edge of the rxvt scrollbar
+ */
+/* #define SB_BORDER */
+
+/*---------------------------MULTILINGUAL-------------------------------*/
+/*
+ * Allow run-time selection of Meta (Alt) to set the 8th bit on
+ */
+#define META8_OPTION
+
+/*---------------------------DISPLAY OPTIONS----------------------------*/
+/*
+ * Force local connection to be socket (or other local) communication
+ */
+/* #define LOCAL_X_IS_UNIX */
+
+/*
+ * Have DISPLAY environment variable & "\E[7n" transmit display with IP number
+ */
+/* #define DISPLAY_IS_IP */
+
+/*
+ * Change what ESC Z transmits instead of the default "\E[?1;2c"
+ */
+/* #define ESCZ_ANSWER "\033[?1;2C" */
+
+/*
+ * Allow foreground/background colour to be changed with xterm
+ * operating system commands.
+ */
+#define XTERM_COLOR_CHANGE
+
+/*
+ * Remove secondary screen's independent cursor position, a la xterm
+ */
+/* #define NO_SECONDARY_SCREEN_CURSOR */
+
+/*
+ * Provide termcap/terminfo bw support (wrap backwards on cub1)
+ */
+#define TERMCAP_HAS_BW 1
+
+/*
+ * The duration of the visual bell flash in s. The default of 20ms
+ * corresponds to the delay given in the terminfo flash code.
+ */
+#define VISUAL_BELL_DURATION .020
+
+/*--------------------------------OTHER---------------------------------*/
+
+/*
+ * Enable the linux yield/usleep hack, which can dramatically improve
+ * performance by working around the linux kernel tty ratelimit bug.
+ * Unfortunately, it seems screen is negatively affected by this on some
+ * machines, so it is disabled by default. Use freebsd or any other kernel
+ * that doesn't suffer from this bug and it will be fast either way.
+ *
+ * See command.C for details.
+ */
+#if __linux__
+# define LINUX_YIELD_HACK 0
+#endif
+
+/* DEFAULT RESOURCES VALUES */
+
+/*
+ * Define default colours for certain items. If you have a low colour
+ * display, then consider using colours which are already pre-allocated:
+ *
+ * Black (#000000)
+ * Red3 (#CD0000)
+ * Green3 (#00CD00)
+ * Yellow3 (#CDCD00)
+ * Blue3 (#0000CD)
+ * Magenta3 (#CD00CD)
+ * Cyan3 (#00CDCD)
+ * AntiqueWhite (#FAEBD7)
+ * Grey25 (#404040)
+ * Red (#FF0000)
+ * Green (#00FF00)
+ * Yellow (#FFFF00)
+ * Blue (#0000FF)
+ * Magenta (#FF00FF)
+ * Cyan (#00FFFF)
+ * White (#FFFFFF)
+ */
+/* These colours MUST be defined */
+#define COLOR_FOREGROUND "rgb:00/00/00"
+#define COLOR_BACKGROUND "rgb:ff/ff/ff"
+#define COLOR_SCROLLBAR "rgb:b2/b2/b2" /* scrollColor match Netscape */
+#define COLOR_SCROLLTROUGH "rgb:96/96/96"
+
+/*
+ * The cursor colours are special. Be very careful about setting these:
+ * foreground/background colours may be modified by command line or resources
+ * prior to this allocation. Also, they are not valid if NO_CURSORCOLOR is
+ * defined
+ */
+#define COLOR_CURSOR_FOREGROUND NULL /* if NULL, use background colour */
+#define COLOR_CURSOR_BACKGROUND NULL /* if NULL, use foreground colour */
+
+/*
+ * Printer pipe which will be used for emulation of attached vt100 printer
+ */
+#define PRINTPIPE "lpr"
+
+/*
+ * Define defaults for backspace and delete keys - unless they have been
+ * configured out with --disable-backspace-key / --disable-delete-key
+ */
+#define DEFAULT_BACKSPACE "DEC" /* SPECIAL */
+#define DEFAULT_DELETE "\033[3~"
+
+/*
+ * Default separating chars for multiple-click selection
+ * Space and tab are separate separating characters and are not settable
+ */
+#define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}"
+
+/*
+ * Width of the term internal border
+ */
+#define INTERNALBORDERWIDTH 2
+
+/*
+ * Width of the term external border
+ */
+#define EXTERNALBORDERWIDTH 0
+
+/*
+ * Default number of extra dots between lines
+ */
+#define LINESPACE 0
+
+/*
+ * Default number of extra dots between columns
+ */
+#define LETTERSPACE 0
+
+/*
+ * Default number of lines in the scrollback buffer
+ */
+#define SAVELINES 1000