… | |
… | |
56 | STRNCPY (curlocale, locale, 128); |
56 | STRNCPY (curlocale, locale, 128); |
57 | setlocale (LC_CTYPE, curlocale); |
57 | setlocale (LC_CTYPE, curlocale); |
58 | } |
58 | } |
59 | } |
59 | } |
60 | |
60 | |
|
|
61 | class rxvt_composite_vec rxvt_composite; |
|
|
62 | |
|
|
63 | text_t rxvt_composite_vec::compose (uint32_t c1, uint32_t c2) |
|
|
64 | { |
|
|
65 | compose_char *cc; |
|
|
66 | |
|
|
67 | // break compose chains, as stupid readline really likes to duplicate |
|
|
68 | // composing characters for some reason near the end of a line. |
|
|
69 | cc = (*this)[c1]; |
|
|
70 | while (cc) |
|
|
71 | { |
|
|
72 | if (cc->c2 == c2) return c1; |
|
|
73 | cc = (*this)[cc->c1]; |
|
|
74 | } |
|
|
75 | |
|
|
76 | // check to see wether this combination already exists otherwise |
|
|
77 | for (cc = v.end (); cc-- > v.begin (); ) |
|
|
78 | { |
|
|
79 | if (cc->c1 == c1 && cc->c2 == c2) |
|
|
80 | return COMPOSE_LO + (cc - v.begin ()); |
|
|
81 | } |
|
|
82 | |
|
|
83 | // allocate a new combination |
|
|
84 | if (v.size () == COMPOSE_HI - COMPOSE_LO + 1) |
|
|
85 | { |
|
|
86 | static int seen; |
|
|
87 | |
|
|
88 | if (!seen++) |
|
|
89 | fprintf (stderr, "too many unrepresentable composite characters, try --enable-unicode3\n"); |
|
|
90 | |
|
|
91 | return REPLACEMENT_CHAR; |
|
|
92 | } |
|
|
93 | |
|
|
94 | v.push_back (compose_char (c1, c2)); |
|
|
95 | |
|
|
96 | return v.size () - 1 + COMPOSE_LO; |
|
|
97 | } |
|
|
98 | |
|
|
99 | int rxvt_composite_vec::expand (uint32_t c, wchar_t *r) |
|
|
100 | { |
|
|
101 | compose_char *cc = (*this)[c]; |
|
|
102 | |
|
|
103 | if (!cc) |
|
|
104 | { |
|
|
105 | if (r) *r = c; |
|
|
106 | return 1; |
|
|
107 | } |
|
|
108 | |
|
|
109 | int len = expand (cc->c1, r); |
|
|
110 | |
|
|
111 | if (r) r += len; |
|
|
112 | |
|
|
113 | if (cc->c2 != NOCHAR) |
|
|
114 | { |
|
|
115 | len++; |
|
|
116 | if (r) *r++ = cc->c2; |
|
|
117 | } |
|
|
118 | |
|
|
119 | return len; |
|
|
120 | |
|
|
121 | } |
|
|
122 | |
|
|
123 | extern struct rxvt_composite_vec rxvt_composite; |
61 | void * |
124 | void * |
62 | rxvt_term::operator new (size_t s) |
125 | rxvt_term::operator new (size_t s) |
63 | { |
126 | { |
64 | void *p = malloc (s); |
127 | void *p = malloc (s); |
65 | |
128 | |