aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog186
-rw-r--r--src/alloc.c5
-rw-r--r--src/bidi.c3
-rw-r--r--src/category.c4
-rw-r--r--src/ccl.c57
-rw-r--r--src/character.c2
-rw-r--r--src/character.h8
-rw-r--r--src/charset.c29
-rw-r--r--src/charset.h7
-rw-r--r--src/chartab.c45
-rw-r--r--src/cm.c9
-rw-r--r--src/cm.h33
-rw-r--r--src/coding.c203
-rw-r--r--src/config.in3
-rw-r--r--src/deps.mk4
-rw-r--r--src/dispextern.h8
-rw-r--r--src/fontset.c17
-rw-r--r--src/fringe.c12
-rw-r--r--src/lisp.h26
-rw-r--r--src/scroll.c13
-rw-r--r--src/term.c80
-rw-r--r--src/termchar.h93
-rw-r--r--src/terminal.c5
-rw-r--r--src/tparam.c16
-rw-r--r--src/tparam.h31
-rw-r--r--src/window.c53
-rw-r--r--src/window.h1
-rw-r--r--src/xdisp.c51
-rw-r--r--src/xfaces.c88
-rw-r--r--src/xfns.c52
-rw-r--r--src/xmenu.c22
-rw-r--r--src/xrdb.c8
-rw-r--r--src/xselect.c34
-rw-r--r--src/xterm.c193
-rw-r--r--src/xterm.h1
35 files changed, 732 insertions, 670 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c4af193d1b0..5991d9e0665 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,189 @@
12011-03-11 Paul Eggert <eggert@cs.ucla.edu>
2
3 Minor changes for problems found by GCC 4.5.2's static checks.
4
5 * fringe.c (update_window_fringes): Mark locals as initialized
6 (Bug#8227).
7 (destroy_fringe_bitmap, init_fringe_bitmap): Now static.
8
9 * alloc.c (mark_fringe_data): Move decl from here ...
10 * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here,
11 to check its interface.
12 (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM.
13
14 * fontset.c (free_realized_fontset): Now static.
15 (Fset_fontset_font): Rename local to avoid shadowing.
16 (fontset_font): Mark local as initialized.
17 (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused.
18
19 * xrdb.c: Include "xterm.h", to check x_load_resources's interface.
20
21 * xselect.c (x_disown_buffer_selections): Remove; not used.
22 (TRACE3) [!defined TRACE_SELECTION]: Remove; not used.
23 (x_own_selection, Fx_disown_selection_internal): Rename locals
24 to avoid shadowing.
25 (x_handle_dnd_message): Remove local to avoid shadowing.
26
27 * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros,
28 so that the caller can use some name other than gcpro1.
29 (GCPRO1, UNGCPRO): Reimplement in terms of the new macros.
30 * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
31 (Fx_backspace_delete_keys_p):
32 Use them to avoid shadowing, and rename vars to avoid shadowing.
33 (x_decode_color, x_set_name, x_window): Now static.
34 (Fx_create_frame): Add braces to silence GCC warning.
35 (Fx_file_dialog, Fx_select_font): Fix pointer signedness.
36 (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame):
37 Remove unused locals.
38 (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
39 (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing.
40 Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR
41 macros.
42
43 * xterm.h (x_mouse_leave): New decl.
44
45 * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame):
46 Remove unused functions.
47 (x_shift_glyphs_for_insert, XTflash, XTring_bell):
48 (x_calc_absolute_position): Now static.
49 (XTread_socket): Don't define label "out" unless it's used.
50 Don't declare local "event" unless it's used.
51 (x_iconify_frame, x_free_frame_resources): Don't declare locals
52 unless they are used.
53 (XEMBED_VERSION, xembed_set_info): Don't define unless needed.
54 (x_fatal_error_signal): Remove; not used.
55 (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position):
56 (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor):
57 (x_error_catcher, x_connection_closed, x_error_handler):
58 (x_error_quitter, xembed_send_message, x_iconify_frame):
59 (my_log_handler): Rename locals to avoid shadowing.
60 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN.
61 (x_connection_closed): Tell GCC not to suggest NO_RETURN.
62
63 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename
64 or move locals to avoid shadowing.
65 (tty_defined_color, merge_face_heights): Now static.
66 (free_realized_faces_for_fontset): Remove; not used.
67 (Fx_list_fonts): Mark variable that gcc -Wuninitialized
68 does not deduce is never used uninitialized.
69 (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used.
70 (LFACEP): Define only if XASSERTS, as it's not needed otherwise.
71
72 * terminal.c (store_terminal_param): Now static.
73
74 * xmenu.c (menu_highlight_callback): Now static.
75 (set_frame_menubar): Remove unused local.
76 (xmenu_show): Rename parameter to avoid shadowing.
77 (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const"
78 since they might point to immutable storage.
79 (next_menubar_widget_id): Declare only if USE_X_TOOLKIT,
80 since it's unused otherwise.
81
82 * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff.
83 Add a FIXME, since the code still doesn't look right. (Bug#8215)
84 (Fcurrent_bidi_paragraph_direction): Simplify slightly; this
85 avoids a gcc -Wuninitialized diagnostic.
86 (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs):
87 (note_mouse_highlight): Mark variables that gcc -Wuninitialized
88 does not deduce are never used uninitialized.
89
90 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c.
91
92 * xdisp.c (redisplay_window): Rename local to avoid shadowing.
93 * window.c (window_loop, size_window):
94 (run_window_configuration_change_hook, enlarge_window): Likewise.
95
96 * window.c (display_buffer): Now static.
97 (size_window): Mark variables that gcc -Wuninitialized
98 does not deduce are never used uninitialized.
99 * window.h (check_all_windows): New decl, to forestall
100 gcc -Wmissing-prototypes diagnostic.
101 * dispextern.h (bidi_dump_cached_states): Likewise.
102
103 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid
104 shadowing.
105 * charset.c (map_charset_for_dump, Fchar_charset): Likewise.
106 Include <limits.h>.
107 (Fsort_charsets): Redo min/max calculation to shorten the code a bit
108 and to avoid gcc -Wuninitialized warning.
109 (load_charset_map): Mark variables that gcc -Wuninitialized
110 does not deduce are never used uninitialized.
111 (load_charset): Abort instead of using uninitialized var (Bug#8229).
112
113 * coding.c (coding_set_source, coding_set_destination):
114 Use "else { /* comment */ }" rather than "else /* comment */;"
115 for clarity, and to avoid gcc -Wempty-body warning.
116 (Fdefine_coding_system_internal): Don't redeclare 'i' inside
117 a block, when the outer 'i' will do.
118 (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule):
119 (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022):
120 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5):
121 (decode_coding_raw_text, decode_coding_charset, get_translation_table):
122 (Fdecode_sjis_char, Fdefine_coding_system_internal):
123 Rename locals to avoid shadowing.
124 * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise.
125 * coding.c (emacs_mule_char, encode_invocation_designation):
126 Now static, since they're not used elsewhere.
127 (decode_coding_iso_2022): Add "default: abort ();" as a safety check.
128 (decode_coding_object, encode_coding_object, detect_coding_system):
129 (decode_coding_emacs_mule): Mark variables that gcc
130 -Wuninitialized does not deduce are never used uninitialized.
131 (detect_coding_iso_2022): Initialize a local variable that might
132 be used uninitialized. Leave a FIXME because it's not clear that
133 this initialization is needed. (Bug#8211)
134 (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT):
135 (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P):
136 (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER):
137 (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R):
138 Remove unused macros.
139
140 * category.c (hash_get_category_set): Remove unused local var.
141 (copy_category_table): Now static, since it's not used elsewhere.
142 * character.c (string_count_byte8): Likewise.
143
144 * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string):
145 (Fregister_code_conversion_map): Rename locals to avoid shadowing.
146
147 * chartab.c (copy_sub_char_table): Now static, since it's not used
148 elsewhere.
149 (sub_char_table_ref_and_range, char_table_ref_and_range):
150 Rename locals to avoid shadowing.
151 (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros.
152
153 * bidi.c (bidi_check_type): Now static, since it's not used elsewhere.
154 (BIDI_BOB): Remove unused macro.
155
156 * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not
157 deduce are never used uninitialized.
158 * term.c (encode_terminal_code): Likewise.
159
160 * term.c (encode_terminal_code): Now static. Remove unused local.
161
162 * tparam.h: New file.
163 * term.c, tparam.h: Include it.
164 * deps.mk (term.o, tparam.o): Depend on tparam.h.
165 * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
166 Move these decls to tparam.h, and make them agree with what
167 is actually in tparam.c. The previous trick of using incompatible
168 decls in different modules does not conform to the C standard.
169 All callers of tparam changed to use tparam's actual API.
170 * tparam.c (tparam1, tparam, tgoto):
171 Use const pointers where appropriate.
172
173 * cm.c (calccost, cmgoto): Use const pointers where appropriate.
174 * cm.h (struct cm): Likewise.
175 * dispextern.h (do_line_insertion_deletion_costs): Likewise.
176 * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise.
177 * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table):
178 (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph):
179 (turn_on_face, init_tty): Likewise.
180 * termchar.h (struct tty_display_info): Likewise.
181
182 * term.c (term_mouse_position): Rename local to avoid shadowing.
183
184 * alloc.c (mark_ttys): Move decl from here ...
185 * lisp.h (mark_ttys): ... to here, so that it's checked against defn.
186
12011-03-11 Andreas Schwab <schwab@linux-m68k.org> 1872011-03-11 Andreas Schwab <schwab@linux-m68k.org>
2 188
3 * .gdbinit (pwinx, xbuffer): Fix access to buffer name. 189 * .gdbinit (pwinx, xbuffer): Fix access to buffer name.
diff --git a/src/alloc.c b/src/alloc.c
index d7006ca6bfd..6c92f36ca7d 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -271,16 +271,11 @@ Lisp_Object Qpost_gc_hook;
271static void mark_buffer (Lisp_Object); 271static void mark_buffer (Lisp_Object);
272static void mark_terminals (void); 272static void mark_terminals (void);
273extern void mark_kboards (void); 273extern void mark_kboards (void);
274extern void mark_ttys (void);
275extern void mark_backtrace (void); 274extern void mark_backtrace (void);
276static void gc_sweep (void); 275static void gc_sweep (void);
277static void mark_glyph_matrix (struct glyph_matrix *); 276static void mark_glyph_matrix (struct glyph_matrix *);
278static void mark_face_cache (struct face_cache *); 277static void mark_face_cache (struct face_cache *);
279 278
280#ifdef HAVE_WINDOW_SYSTEM
281extern void mark_fringe_data (void);
282#endif /* HAVE_WINDOW_SYSTEM */
283
284static struct Lisp_String *allocate_string (void); 279static struct Lisp_String *allocate_string (void);
285static void compact_small_strings (void); 280static void compact_small_strings (void);
286static void free_large_strings (void); 281static void free_large_strings (void);
diff --git a/src/bidi.c b/src/bidi.c
index eeacf65bd5c..3457e177436 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -72,7 +72,6 @@ static Lisp_Object bidi_type_table, bidi_mirror_table;
72#define RLO_CHAR 0x202E 72#define RLO_CHAR 0x202E
73 73
74#define BIDI_EOB -1 74#define BIDI_EOB -1
75#define BIDI_BOB -2 /* FIXME: Is this needed? */
76 75
77/* Local data structures. (Look in dispextern.h for the rest.) */ 76/* Local data structures. (Look in dispextern.h for the rest.) */
78 77
@@ -180,7 +179,7 @@ bidi_get_type (int ch, bidi_dir_t override)
180 } 179 }
181} 180}
182 181
183void 182static void
184bidi_check_type (bidi_type_t type) 183bidi_check_type (bidi_type_t type)
185{ 184{
186 if (type < UNKNOWN_BT || type > NEUTRAL_ON) 185 if (type < UNKNOWN_BT || type > NEUTRAL_ON)
diff --git a/src/category.c b/src/category.c
index bcd73d3a487..cc7ff88474f 100644
--- a/src/category.c
+++ b/src/category.c
@@ -61,7 +61,6 @@ static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object);
61static Lisp_Object 61static Lisp_Object
62hash_get_category_set (Lisp_Object table, Lisp_Object category_set) 62hash_get_category_set (Lisp_Object table, Lisp_Object category_set)
63{ 63{
64 Lisp_Object val;
65 struct Lisp_Hash_Table *h; 64 struct Lisp_Hash_Table *h;
66 int i; 65 int i;
67 unsigned hash; 66 unsigned hash;
@@ -228,7 +227,7 @@ copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val)
228 the original and the copy. This function is called recursively by 227 the original and the copy. This function is called recursively by
229 binding TABLE to a sub char table. */ 228 binding TABLE to a sub char table. */
230 229
231Lisp_Object 230static Lisp_Object
232copy_category_table (Lisp_Object table) 231copy_category_table (Lisp_Object table)
233{ 232{
234 table = copy_char_table (table); 233 table = copy_char_table (table);
@@ -538,4 +537,3 @@ See the documentation of the variable `word-combining-categories'. */);
538 537
539 category_table_version = 0; 538 category_table_version = 0;
540} 539}
541
diff --git a/src/ccl.c b/src/ccl.c
index 411c041b22a..5428e94c69a 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -758,18 +758,18 @@ while(0)
758 buffer. */ 758 buffer. */
759#define CCL_WRITE_STRING(len) \ 759#define CCL_WRITE_STRING(len) \
760 do { \ 760 do { \
761 int i; \ 761 int ccli; \
762 if (!dst) \ 762 if (!dst) \
763 CCL_INVALID_CMD; \ 763 CCL_INVALID_CMD; \
764 else if (dst + len <= dst_end) \ 764 else if (dst + len <= dst_end) \
765 { \ 765 { \
766 if (XFASTINT (ccl_prog[ic]) & 0x1000000) \ 766 if (XFASTINT (ccl_prog[ic]) & 0x1000000) \
767 for (i = 0; i < len; i++) \ 767 for (ccli = 0; ccli < len; ccli++) \
768 *dst++ = XFASTINT (ccl_prog[ic + i]) & 0xFFFFFF; \ 768 *dst++ = XFASTINT (ccl_prog[ic + ccli]) & 0xFFFFFF; \
769 else \ 769 else \
770 for (i = 0; i < len; i++) \ 770 for (ccli = 0; ccli < len; ccli++) \
771 *dst++ = ((XFASTINT (ccl_prog[ic + (i / 3)])) \ 771 *dst++ = ((XFASTINT (ccl_prog[ic + (ccli / 3)])) \
772 >> ((2 - (i % 3)) * 8)) & 0xFF; \ 772 >> ((2 - (ccli % 3)) * 8)) & 0xFF; \
773 } \ 773 } \
774 else \ 774 else \
775 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ 775 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \
@@ -806,15 +806,15 @@ while(0)
806 806
807#define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \ 807#define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \
808 do { \ 808 do { \
809 unsigned code; \ 809 unsigned ncode; \
810 \ 810 \
811 charset = char_charset ((c), (charset_list), &code); \ 811 charset = char_charset ((c), (charset_list), &ncode); \
812 if (! charset && ! NILP (charset_list)) \ 812 if (! charset && ! NILP (charset_list)) \
813 charset = char_charset ((c), Qnil, &code); \ 813 charset = char_charset ((c), Qnil, &ncode); \
814 if (charset) \ 814 if (charset) \
815 { \ 815 { \
816 (id) = CHARSET_ID (charset); \ 816 (id) = CHARSET_ID (charset); \
817 (encoded) = code; \ 817 (encoded) = ncode; \
818 } \ 818 } \
819 } while (0) 819 } while (0)
820 820
@@ -2092,22 +2092,22 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2092 { 2092 {
2093 const unsigned char *p = SDATA (str) + consumed_bytes; 2093 const unsigned char *p = SDATA (str) + consumed_bytes;
2094 const unsigned char *endp = SDATA (str) + str_bytes; 2094 const unsigned char *endp = SDATA (str) + str_bytes;
2095 int i = 0; 2095 int j = 0;
2096 int *src, src_size; 2096 int *src, src_size;
2097 2097
2098 if (endp - p == str_chars - consumed_chars) 2098 if (endp - p == str_chars - consumed_chars)
2099 while (i < CCL_EXECUTE_BUF_SIZE && p < endp) 2099 while (j < CCL_EXECUTE_BUF_SIZE && p < endp)
2100 source[i++] = *p++; 2100 source[j++] = *p++;
2101 else 2101 else
2102 while (i < CCL_EXECUTE_BUF_SIZE && p < endp) 2102 while (j < CCL_EXECUTE_BUF_SIZE && p < endp)
2103 source[i++] = STRING_CHAR_ADVANCE (p); 2103 source[j++] = STRING_CHAR_ADVANCE (p);
2104 consumed_chars += i; 2104 consumed_chars += j;
2105 consumed_bytes = p - SDATA (str); 2105 consumed_bytes = p - SDATA (str);
2106 2106
2107 if (consumed_bytes == str_bytes) 2107 if (consumed_bytes == str_bytes)
2108 ccl.last_block = NILP (contin); 2108 ccl.last_block = NILP (contin);
2109 src = source; 2109 src = source;
2110 src_size = i; 2110 src_size = j;
2111 while (1) 2111 while (1)
2112 { 2112 {
2113 ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE, 2113 ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE,
@@ -2123,8 +2123,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2123 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); 2123 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize);
2124 outp = outbuf + offset; 2124 outp = outbuf + offset;
2125 } 2125 }
2126 for (i = 0; i < ccl.produced; i++) 2126 for (j = 0; j < ccl.produced; j++)
2127 CHAR_STRING_ADVANCE (destination[i], outp); 2127 CHAR_STRING_ADVANCE (destination[j], outp);
2128 } 2128 }
2129 else 2129 else
2130 { 2130 {
@@ -2135,8 +2135,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2135 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); 2135 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize);
2136 outp = outbuf + offset; 2136 outp = outbuf + offset;
2137 } 2137 }
2138 for (i = 0; i < ccl.produced; i++) 2138 for (j = 0; j < ccl.produced; j++)
2139 *outp++ = destination[i]; 2139 *outp++ = destination[j];
2140 } 2140 }
2141 src += ccl.consumed; 2141 src += ccl.consumed;
2142 src_size -= ccl.consumed; 2142 src_size -= ccl.consumed;
@@ -2253,7 +2253,7 @@ Return index number of the registered map. */)
2253{ 2253{
2254 int len = ASIZE (Vcode_conversion_map_vector); 2254 int len = ASIZE (Vcode_conversion_map_vector);
2255 int i; 2255 int i;
2256 Lisp_Object index; 2256 Lisp_Object idx;
2257 2257
2258 CHECK_SYMBOL (symbol); 2258 CHECK_SYMBOL (symbol);
2259 CHECK_VECTOR (map); 2259 CHECK_VECTOR (map);
@@ -2267,11 +2267,11 @@ Return index number of the registered map. */)
2267 2267
2268 if (EQ (symbol, XCAR (slot))) 2268 if (EQ (symbol, XCAR (slot)))
2269 { 2269 {
2270 index = make_number (i); 2270 idx = make_number (i);
2271 XSETCDR (slot, map); 2271 XSETCDR (slot, map);
2272 Fput (symbol, Qcode_conversion_map, map); 2272 Fput (symbol, Qcode_conversion_map, map);
2273 Fput (symbol, Qcode_conversion_map_id, index); 2273 Fput (symbol, Qcode_conversion_map_id, idx);
2274 return index; 2274 return idx;
2275 } 2275 }
2276 } 2276 }
2277 2277
@@ -2279,11 +2279,11 @@ Return index number of the registered map. */)
2279 Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector, 2279 Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector,
2280 len * 2, Qnil); 2280 len * 2, Qnil);
2281 2281
2282 index = make_number (i); 2282 idx = make_number (i);
2283 Fput (symbol, Qcode_conversion_map, map); 2283 Fput (symbol, Qcode_conversion_map, map);
2284 Fput (symbol, Qcode_conversion_map_id, index); 2284 Fput (symbol, Qcode_conversion_map_id, idx);
2285 ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map)); 2285 ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map));
2286 return index; 2286 return idx;
2287} 2287}
2288 2288
2289 2289
@@ -2341,4 +2341,3 @@ used by CCL. */);
2341 defsubr (&Sregister_ccl_program); 2341 defsubr (&Sregister_ccl_program);
2342 defsubr (&Sregister_code_conversion_map); 2342 defsubr (&Sregister_code_conversion_map);
2343} 2343}
2344
diff --git a/src/character.c b/src/character.c
index 6f3312fec29..fdaf22f04f8 100644
--- a/src/character.c
+++ b/src/character.c
@@ -786,7 +786,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, i
786} 786}
787 787
788 788
789EMACS_INT 789static EMACS_INT
790string_count_byte8 (Lisp_Object string) 790string_count_byte8 (Lisp_Object string)
791{ 791{
792 int multibyte = STRING_MULTIBYTE (string); 792 int multibyte = STRING_MULTIBYTE (string);
diff --git a/src/character.h b/src/character.h
index fb29ced66b7..d29ab41557b 100644
--- a/src/character.h
+++ b/src/character.h
@@ -356,11 +356,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
356 CHARIDX++; \ 356 CHARIDX++; \
357 if (STRING_MULTIBYTE (STRING)) \ 357 if (STRING_MULTIBYTE (STRING)) \
358 { \ 358 { \
359 unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ 359 unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \
360 int len; \ 360 int string_len; \
361 \ 361 \
362 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ 362 OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \
363 BYTEIDX += len; \ 363 BYTEIDX += string_len; \
364 } \ 364 } \
365 else \ 365 else \
366 { \ 366 { \
diff --git a/src/charset.c b/src/charset.c
index 3624e740acb..d82b29ae44b 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include <stdio.h> 29#include <stdio.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <ctype.h> 31#include <ctype.h>
32#include <limits.h>
32#include <sys/types.h> 33#include <sys/types.h>
33#include <setjmp.h> 34#include <setjmp.h>
34#include "lisp.h" 35#include "lisp.h"
@@ -250,7 +251,7 @@ struct charset_map_entries
250static void 251static void
251load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) 252load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag)
252{ 253{
253 Lisp_Object vec, table; 254 Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
254 unsigned max_code = CHARSET_MAX_CODE (charset); 255 unsigned max_code = CHARSET_MAX_CODE (charset);
255 int ascii_compatible_p = charset->ascii_compatible_p; 256 int ascii_compatible_p = charset->ascii_compatible_p;
256 int min_char, max_char, nonascii_min_char; 257 int min_char, max_char, nonascii_min_char;
@@ -629,8 +630,12 @@ load_charset (struct charset *charset, int control_flag)
629 630
630 if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP) 631 if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP)
631 map = CHARSET_MAP (charset); 632 map = CHARSET_MAP (charset);
632 else if (CHARSET_UNIFIED_P (charset)) 633 else
633 map = CHARSET_UNIFY_MAP (charset); 634 {
635 if (! CHARSET_UNIFIED_P (charset))
636 abort ();
637 map = CHARSET_UNIFY_MAP (charset);
638 }
634 if (STRINGP (map)) 639 if (STRINGP (map))
635 load_charset_map_from_file (charset, map, control_flag); 640 load_charset_map_from_file (charset, map, control_flag);
636 else 641 else
@@ -668,9 +673,9 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object
668 673
669 while (1) 674 while (1)
670 { 675 {
671 int index = GET_TEMP_CHARSET_WORK_ENCODER (c); 676 int idx = GET_TEMP_CHARSET_WORK_ENCODER (c);
672 677
673 if (index >= from_idx && index <= to_idx) 678 if (idx >= from_idx && idx <= to_idx)
674 { 679 {
675 if (NILP (XCAR (range))) 680 if (NILP (XCAR (range)))
676 XSETCAR (range, make_number (c)); 681 XSETCAR (range, make_number (c));
@@ -2066,10 +2071,10 @@ that case, find the charset from what supported by that coding system. */)
2066 2071
2067 for (; CONSP (restriction); restriction = XCDR (restriction)) 2072 for (; CONSP (restriction); restriction = XCDR (restriction))
2068 { 2073 {
2069 struct charset *charset; 2074 struct charset *rcharset;
2070 2075
2071 CHECK_CHARSET_GET_CHARSET (XCAR (restriction), charset); 2076 CHECK_CHARSET_GET_CHARSET (XCAR (restriction), rcharset);
2072 if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset)) 2077 if (ENCODE_CHAR (rcharset, c) != CHARSET_INVALID_CODE (rcharset))
2073 return XCAR (restriction); 2078 return XCAR (restriction);
2074 } 2079 }
2075 return Qnil; 2080 return Qnil;
@@ -2250,7 +2255,7 @@ See also `charset-priority-list' and `set-charset-priority'. */)
2250 int n = XFASTINT (len), i, j, done; 2255 int n = XFASTINT (len), i, j, done;
2251 Lisp_Object tail, elt, attrs; 2256 Lisp_Object tail, elt, attrs;
2252 struct charset_sort_data *sort_data; 2257 struct charset_sort_data *sort_data;
2253 int id, min_id, max_id; 2258 int id, min_id = INT_MAX, max_id = INT_MIN;
2254 USE_SAFE_ALLOCA; 2259 USE_SAFE_ALLOCA;
2255 2260
2256 if (n == 0) 2261 if (n == 0)
@@ -2262,11 +2267,9 @@ See also `charset-priority-list' and `set-charset-priority'. */)
2262 CHECK_CHARSET_GET_ATTR (elt, attrs); 2267 CHECK_CHARSET_GET_ATTR (elt, attrs);
2263 sort_data[i].charset = elt; 2268 sort_data[i].charset = elt;
2264 sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); 2269 sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs));
2265 if (i == 0) 2270 if (id < min_id)
2266 min_id = max_id = id;
2267 else if (id < min_id)
2268 min_id = id; 2271 min_id = id;
2269 else if (id > max_id) 2272 if (id > max_id)
2270 max_id = id; 2273 max_id = id;
2271 } 2274 }
2272 for (done = 0, tail = Vcharset_ordered_list, i = 0; 2275 for (done = 0, tail = Vcharset_ordered_list, i = 0;
diff --git a/src/charset.h b/src/charset.h
index 1fc552a5bd3..8c87ffe6c3d 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -358,9 +358,9 @@ extern int emacs_mule_charset[256];
358 358
359#define CHECK_CHARSET_GET_CHARSET(x, charset) \ 359#define CHECK_CHARSET_GET_CHARSET(x, charset) \
360 do { \ 360 do { \
361 int id; \ 361 int csid; \
362 CHECK_CHARSET_GET_ID (x, id); \ 362 CHECK_CHARSET_GET_ID (x, csid); \
363 charset = CHARSET_FROM_ID (id); \ 363 charset = CHARSET_FROM_ID (csid); \
364 } while (0) 364 } while (0)
365 365
366 366
@@ -541,4 +541,3 @@ extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object),
541 struct charset *, unsigned, unsigned); 541 struct charset *, unsigned, unsigned);
542 542
543#endif /* EMACS_CHARSET_H */ 543#endif /* EMACS_CHARSET_H */
544
diff --git a/src/chartab.c b/src/chartab.c
index cd8aa784eb4..85aa5932ac3 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -118,7 +118,7 @@ char_table_ascii (Lisp_Object table)
118 return XSUB_CHAR_TABLE (sub)->contents[0]; 118 return XSUB_CHAR_TABLE (sub)->contents[0];
119} 119}
120 120
121Lisp_Object 121static Lisp_Object
122copy_sub_char_table (Lisp_Object table) 122copy_sub_char_table (Lisp_Object table)
123{ 123{
124 Lisp_Object copy; 124 Lisp_Object copy;
@@ -216,16 +216,16 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp
216 int depth = XINT (tbl->depth); 216 int depth = XINT (tbl->depth);
217 int min_char = XINT (tbl->min_char); 217 int min_char = XINT (tbl->min_char);
218 int max_char = min_char + chartab_chars[depth - 1] - 1; 218 int max_char = min_char + chartab_chars[depth - 1] - 1;
219 int index = CHARTAB_IDX (c, depth, min_char), idx; 219 int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx;
220 Lisp_Object val; 220 Lisp_Object val;
221 221
222 val = tbl->contents[index]; 222 val = tbl->contents[chartab_idx];
223 if (SUB_CHAR_TABLE_P (val)) 223 if (SUB_CHAR_TABLE_P (val))
224 val = sub_char_table_ref_and_range (val, c, from, to, defalt); 224 val = sub_char_table_ref_and_range (val, c, from, to, defalt);
225 else if (NILP (val)) 225 else if (NILP (val))
226 val = defalt; 226 val = defalt;
227 227
228 idx = index; 228 idx = chartab_idx;
229 while (idx > 0 && *from < min_char + idx * chartab_chars[depth]) 229 while (idx > 0 && *from < min_char + idx * chartab_chars[depth])
230 { 230 {
231 Lisp_Object this_val; 231 Lisp_Object this_val;
@@ -244,13 +244,13 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp
244 break; 244 break;
245 } 245 }
246 } 246 }
247 while ((c = min_char + (index + 1) * chartab_chars[depth]) <= max_char 247 while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char
248 && *to >= c) 248 && *to >= c)
249 { 249 {
250 Lisp_Object this_val; 250 Lisp_Object this_val;
251 251
252 index++; 252 chartab_idx++;
253 this_val = tbl->contents[index]; 253 this_val = tbl->contents[chartab_idx];
254 if (SUB_CHAR_TABLE_P (this_val)) 254 if (SUB_CHAR_TABLE_P (this_val))
255 this_val = sub_char_table_ref_and_range (this_val, c, from, to, defalt); 255 this_val = sub_char_table_ref_and_range (this_val, c, from, to, defalt);
256 else if (NILP (this_val)) 256 else if (NILP (this_val))
@@ -275,10 +275,10 @@ Lisp_Object
275char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) 275char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
276{ 276{
277 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); 277 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
278 int index = CHARTAB_IDX (c, 0, 0), idx; 278 int chartab_idx = CHARTAB_IDX (c, 0, 0), idx;
279 Lisp_Object val; 279 Lisp_Object val;
280 280
281 val = tbl->contents[index]; 281 val = tbl->contents[chartab_idx];
282 if (*from < 0) 282 if (*from < 0)
283 *from = 0; 283 *from = 0;
284 if (*to < 0) 284 if (*to < 0)
@@ -288,7 +288,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
288 else if (NILP (val)) 288 else if (NILP (val))
289 val = tbl->defalt; 289 val = tbl->defalt;
290 290
291 idx = index; 291 idx = chartab_idx;
292 while (*from < idx * chartab_chars[0]) 292 while (*from < idx * chartab_chars[0])
293 { 293 {
294 Lisp_Object this_val; 294 Lisp_Object this_val;
@@ -308,13 +308,13 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
308 break; 308 break;
309 } 309 }
310 } 310 }
311 while (*to >= (index + 1) * chartab_chars[0]) 311 while (*to >= (chartab_idx + 1) * chartab_chars[0])
312 { 312 {
313 Lisp_Object this_val; 313 Lisp_Object this_val;
314 314
315 index++; 315 chartab_idx++;
316 c = index * chartab_chars[0]; 316 c = chartab_idx * chartab_chars[0];
317 this_val = tbl->contents[index]; 317 this_val = tbl->contents[chartab_idx];
318 if (SUB_CHAR_TABLE_P (this_val)) 318 if (SUB_CHAR_TABLE_P (this_val))
319 this_val = sub_char_table_ref_and_range (this_val, c, from, to, 319 this_val = sub_char_table_ref_and_range (this_val, c, from, to,
320 tbl->defalt); 320 tbl->defalt);
@@ -331,20 +331,6 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
331} 331}
332 332
333 333
334#define ASET_RANGE(ARRAY, FROM, TO, LIMIT, VAL) \
335 do { \
336 int limit = (TO) < (LIMIT) ? (TO) : (LIMIT); \
337 for (; (FROM) < limit; (FROM)++) (ARRAY)->contents[(FROM)] = (VAL); \
338 } while (0)
339
340#define GET_SUB_CHAR_TABLE(TABLE, SUBTABLE, IDX, DEPTH, MIN_CHAR) \
341 do { \
342 (SUBTABLE) = (TABLE)->contents[(IDX)]; \
343 if (!SUB_CHAR_TABLE_P (SUBTABLE)) \
344 (SUBTABLE) = make_sub_char_table ((DEPTH), (MIN_CHAR), (SUBTABLE)); \
345 } while (0)
346
347
348static void 334static void
349sub_char_table_set (Lisp_Object table, int c, Lisp_Object val) 335sub_char_table_set (Lisp_Object table, int c, Lisp_Object val)
350{ 336{
@@ -951,7 +937,7 @@ map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object),
951 map_charset_chars. */ 937 map_charset_chars. */
952 938
953void 939void
954map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), 940map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object),
955 Lisp_Object function, Lisp_Object table, Lisp_Object arg, 941 Lisp_Object function, Lisp_Object table, Lisp_Object arg,
956 struct charset *charset, 942 struct charset *charset,
957 unsigned from, unsigned to) 943 unsigned from, unsigned to)
@@ -1012,4 +998,3 @@ syms_of_chartab (void)
1012 defsubr (&Soptimize_char_table); 998 defsubr (&Soptimize_char_table);
1013 defsubr (&Smap_char_table); 999 defsubr (&Smap_char_table);
1014} 1000}
1015
diff --git a/src/cm.c b/src/cm.c
index d4aedad6db4..108ee5720f3 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -199,7 +199,7 @@ calccost (struct tty_display_info *tty,
199 tabx, 199 tabx,
200 tab2x, 200 tab2x,
201 tabcost; 201 tabcost;
202 register char *p; 202 register const char *p;
203 203
204 /* If have just wrapped on a terminal with xn, 204 /* If have just wrapped on a terminal with xn,
205 don't believe the cursor position: give up here 205 don't believe the cursor position: give up here
@@ -330,9 +330,9 @@ cmgoto (struct tty_display_info *tty, int row, int col)
330 llcost, 330 llcost,
331 relcost, 331 relcost,
332 directcost; 332 directcost;
333 int use; 333 int use IF_LINT (= 0);
334 char *p, 334 char *p;
335 *dcm; 335 const char *dcm;
336 336
337 /* First the degenerate case */ 337 /* First the degenerate case */
338 if (row == curY (tty) && col == curX (tty)) /* already there */ 338 if (row == curY (tty) && col == curX (tty)) /* already there */
@@ -460,4 +460,3 @@ Wcm_init (struct tty_display_info *tty)
460 return - 2; 460 return - 2;
461 return 0; 461 return 0;
462} 462}
463
diff --git a/src/cm.h b/src/cm.h
index 7b4bedd4e88..5d430598f0c 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -35,25 +35,25 @@ struct cm
35 int cm_curX; /* Current column */ 35 int cm_curX; /* Current column */
36 36
37 /* Capabilities from termcap */ 37 /* Capabilities from termcap */
38 char *cm_up; /* up (up) */ 38 const char *cm_up; /* up (up) */
39 char *cm_down; /* down (do) */ 39 const char *cm_down; /* down (do) */
40 char *cm_left; /* left (le) */ 40 const char *cm_left; /* left (le) */
41 char *cm_right; /* right (nd) */ 41 const char *cm_right; /* right (nd) */
42 char *cm_home; /* home (ho) */ 42 const char *cm_home; /* home (ho) */
43 char *cm_cr; /* carriage return (cr) */ 43 const char *cm_cr; /* carriage return (cr) */
44 char *cm_ll; /* last line (ll) */ 44 const char *cm_ll; /* last line (ll) */
45 char *cm_tab; /* tab (ta) */ 45 const char *cm_tab; /* tab (ta) */
46 char *cm_backtab; /* backtab (bt) */ 46 const char *cm_backtab; /* backtab (bt) */
47 char *cm_abs; /* absolute (cm) */ 47 char *cm_abs; /* absolute (cm) */
48 char *cm_habs; /* horizontal absolute (ch) */ 48 const char *cm_habs; /* horizontal absolute (ch) */
49 char *cm_vabs; /* vertical absolute (cv) */ 49 const char *cm_vabs; /* vertical absolute (cv) */
50#if 0 50#if 0
51 char *cm_ds; /* "don't send" string (ds) */ 51 const char *cm_ds; /* "don't send" string (ds) */
52#endif 52#endif
53 char *cm_multiup; /* multiple up (UP) */ 53 const char *cm_multiup; /* multiple up (UP) */
54 char *cm_multidown; /* multiple down (DO) */ 54 const char *cm_multidown; /* multiple down (DO) */
55 char *cm_multileft; /* multiple left (LE) */ 55 const char *cm_multileft; /* multiple left (LE) */
56 char *cm_multiright; /* multiple right (RI) */ 56 const char *cm_multiright; /* multiple right (RI) */
57 int cm_cols; /* number of cols on screen (co) */ 57 int cm_cols; /* number of cols on screen (co) */
58 int cm_rows; /* number of rows on screen (li) */ 58 int cm_rows; /* number of rows on screen (li) */
59 int cm_tabwidth; /* tab width (it) */ 59 int cm_tabwidth; /* tab width (it) */
@@ -168,4 +168,3 @@ extern void cmcostinit (struct tty_display_info *);
168extern void cmgoto (struct tty_display_info *, int, int); 168extern void cmgoto (struct tty_display_info *, int, int);
169extern void Wcm_clear (struct tty_display_info *); 169extern void Wcm_clear (struct tty_display_info *);
170extern int Wcm_init (struct tty_display_info *); 170extern int Wcm_init (struct tty_display_info *);
171
diff --git a/src/coding.c b/src/coding.c
index f6310369ad3..9a6a4484e50 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -395,8 +395,6 @@ Lisp_Object Vbig5_coding_system;
395 395
396/* Control characters of ISO2022. */ 396/* Control characters of ISO2022. */
397 /* code */ /* function */ 397 /* code */ /* function */
398#define ISO_CODE_LF 0x0A /* line-feed */
399#define ISO_CODE_CR 0x0D /* carriage-return */
400#define ISO_CODE_SO 0x0E /* shift-out */ 398#define ISO_CODE_SO 0x0E /* shift-out */
401#define ISO_CODE_SI 0x0F /* shift-in */ 399#define ISO_CODE_SI 0x0F /* shift-in */
402#define ISO_CODE_SS2_7 0x19 /* single-shift-2 for 7-bit code */ 400#define ISO_CODE_SS2_7 0x19 /* single-shift-2 for 7-bit code */
@@ -479,7 +477,7 @@ enum iso_code_class_type
479 477
480#define CODING_ISO_FLAG_COMPOSITION 0x2000 478#define CODING_ISO_FLAG_COMPOSITION 0x2000
481 479
482#define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 480/* #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 */
483 481
484#define CODING_ISO_FLAG_USE_ROMAN 0x8000 482#define CODING_ISO_FLAG_USE_ROMAN 0x8000
485 483
@@ -721,25 +719,6 @@ static struct coding_system coding_categories[coding_category_max];
721 } while (0) 719 } while (0)
722 720
723 721
724#define ONE_MORE_BYTE_NO_CHECK(c) \
725 do { \
726 c = *src++; \
727 if (multibytep && (c & 0x80)) \
728 { \
729 if ((c & 0xFE) == 0xC0) \
730 c = ((c & 1) << 6) | *src++; \
731 else \
732 { \
733 src--; \
734 c = - string_char (src, &src, NULL); \
735 record_conversion_result \
736 (coding, CODING_RESULT_INVALID_SRC); \
737 } \
738 } \
739 consumed_chars++; \
740 } while (0)
741
742
743/* Store a byte C in the place pointed by DST and increment DST to the 722/* Store a byte C in the place pointed by DST and increment DST to the
744 next free point, and increment PRODUCED_CHARS. The caller should 723 next free point, and increment PRODUCED_CHARS. The caller should
745 assure that C is 0..127, and declare and set the variable `dst' 724 assure that C is 0..127, and declare and set the variable `dst'
@@ -1051,9 +1030,10 @@ coding_set_source (struct coding_system *coding)
1051 coding->source = SDATA (coding->src_object) + coding->src_pos_byte; 1030 coding->source = SDATA (coding->src_object) + coding->src_pos_byte;
1052 } 1031 }
1053 else 1032 else
1054 /* Otherwise, the source is C string and is never relocated 1033 {
1055 automatically. Thus we don't have to update anything. */ 1034 /* Otherwise, the source is C string and is never relocated
1056 ; 1035 automatically. Thus we don't have to update anything. */
1036 }
1057} 1037}
1058 1038
1059static void 1039static void
@@ -1079,9 +1059,10 @@ coding_set_destination (struct coding_system *coding)
1079 } 1059 }
1080 } 1060 }
1081 else 1061 else
1082 /* Otherwise, the destination is C string and is never relocated 1062 {
1083 automatically. Thus we don't have to update anything. */ 1063 /* Otherwise, the destination is C string and is never relocated
1084 ; 1064 automatically. Thus we don't have to update anything. */
1065 }
1085} 1066}
1086 1067
1087 1068
@@ -1217,7 +1198,6 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
1217#define UTF_8_4_OCTET_LEADING_P(c) (((c) & 0xF8) == 0xF0) 1198#define UTF_8_4_OCTET_LEADING_P(c) (((c) & 0xF8) == 0xF0)
1218#define UTF_8_5_OCTET_LEADING_P(c) (((c) & 0xFC) == 0xF8) 1199#define UTF_8_5_OCTET_LEADING_P(c) (((c) & 0xFC) == 0xF8)
1219 1200
1220#define UTF_BOM 0xFEFF
1221#define UTF_8_BOM_1 0xEF 1201#define UTF_8_BOM_1 0xEF
1222#define UTF_8_BOM_2 0xBB 1202#define UTF_8_BOM_2 0xBB
1223#define UTF_8_BOM_3 0xBF 1203#define UTF_8_BOM_3 0xBF
@@ -1318,7 +1298,7 @@ decode_coding_utf_8 (struct coding_system *coding)
1318 int multibytep = coding->src_multibyte; 1298 int multibytep = coding->src_multibyte;
1319 enum utf_bom_type bom = CODING_UTF_8_BOM (coding); 1299 enum utf_bom_type bom = CODING_UTF_8_BOM (coding);
1320 Lisp_Object attr, charset_list; 1300 Lisp_Object attr, charset_list;
1321 int eol_crlf = 1301 int eol_dos =
1322 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 1302 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
1323 int byte_after_cr = -1; 1303 int byte_after_cr = -1;
1324 1304
@@ -1379,7 +1359,7 @@ decode_coding_utf_8 (struct coding_system *coding)
1379 } 1359 }
1380 else if (UTF_8_1_OCTET_P (c1)) 1360 else if (UTF_8_1_OCTET_P (c1))
1381 { 1361 {
1382 if (eol_crlf && c1 == '\r') 1362 if (eol_dos && c1 == '\r')
1383 ONE_MORE_BYTE (byte_after_cr); 1363 ONE_MORE_BYTE (byte_after_cr);
1384 c = c1; 1364 c = c1;
1385 } 1365 }
@@ -1533,11 +1513,6 @@ encode_coding_utf_8 (struct coding_system *coding)
1533#define UTF_16_LOW_SURROGATE_P(val) \ 1513#define UTF_16_LOW_SURROGATE_P(val) \
1534 (((val) & 0xFC00) == 0xDC00) 1514 (((val) & 0xFC00) == 0xDC00)
1535 1515
1536#define UTF_16_INVALID_P(val) \
1537 (((val) == 0xFFFE) \
1538 || ((val) == 0xFFFF) \
1539 || UTF_16_LOW_SURROGATE_P (val))
1540
1541 1516
1542static int 1517static int
1543detect_coding_utf_16 (struct coding_system *coding, 1518detect_coding_utf_16 (struct coding_system *coding,
@@ -1637,7 +1612,7 @@ decode_coding_utf_16 (struct coding_system *coding)
1637 enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); 1612 enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding);
1638 int surrogate = CODING_UTF_16_SURROGATE (coding); 1613 int surrogate = CODING_UTF_16_SURROGATE (coding);
1639 Lisp_Object attr, charset_list; 1614 Lisp_Object attr, charset_list;
1640 int eol_crlf = 1615 int eol_dos =
1641 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 1616 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
1642 int byte_after_cr1 = -1, byte_after_cr2 = -1; 1617 int byte_after_cr1 = -1, byte_after_cr2 = -1;
1643 1618
@@ -1734,7 +1709,7 @@ decode_coding_utf_16 (struct coding_system *coding)
1734 CODING_UTF_16_SURROGATE (coding) = surrogate = c; 1709 CODING_UTF_16_SURROGATE (coding) = surrogate = c;
1735 else 1710 else
1736 { 1711 {
1737 if (eol_crlf && c == '\r') 1712 if (eol_dos && c == '\r')
1738 { 1713 {
1739 ONE_MORE_BYTE (byte_after_cr1); 1714 ONE_MORE_BYTE (byte_after_cr1);
1740 ONE_MORE_BYTE (byte_after_cr2); 1715 ONE_MORE_BYTE (byte_after_cr2);
@@ -1918,17 +1893,17 @@ detect_coding_emacs_mule (struct coding_system *coding,
1918 it because analyzing it is too heavy for detecting. But, 1893 it because analyzing it is too heavy for detecting. But,
1919 at least, we check that the composite character 1894 at least, we check that the composite character
1920 constitutes of more than 4 bytes. */ 1895 constitutes of more than 4 bytes. */
1921 const unsigned char *src_base; 1896 const unsigned char *src_start;
1922 1897
1923 repeat: 1898 repeat:
1924 src_base = src; 1899 src_start = src;
1925 do 1900 do
1926 { 1901 {
1927 ONE_MORE_BYTE (c); 1902 ONE_MORE_BYTE (c);
1928 } 1903 }
1929 while (c >= 0xA0); 1904 while (c >= 0xA0);
1930 1905
1931 if (src - src_base <= 4) 1906 if (src - src_start <= 4)
1932 break; 1907 break;
1933 found = CATEGORY_MASK_EMACS_MULE; 1908 found = CATEGORY_MASK_EMACS_MULE;
1934 if (c == 0x80) 1909 if (c == 0x80)
@@ -1980,7 +1955,7 @@ detect_coding_emacs_mule (struct coding_system *coding,
1980 the decoded character or rule. If an invalid byte is found, return 1955 the decoded character or rule. If an invalid byte is found, return
1981 -1. If SRC is too short, return -2. */ 1956 -1. If SRC is too short, return -2. */
1982 1957
1983int 1958static int
1984emacs_mule_char (struct coding_system *coding, const unsigned char *src, 1959emacs_mule_char (struct coding_system *coding, const unsigned char *src,
1985 int *nbytes, int *nchars, int *id, 1960 int *nbytes, int *nchars, int *id,
1986 struct composition_status *cmp_status) 1961 struct composition_status *cmp_status)
@@ -1988,7 +1963,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
1988 const unsigned char *src_end = coding->source + coding->src_bytes; 1963 const unsigned char *src_end = coding->source + coding->src_bytes;
1989 const unsigned char *src_base = src; 1964 const unsigned char *src_base = src;
1990 int multibytep = coding->src_multibyte; 1965 int multibytep = coding->src_multibyte;
1991 int charset_id; 1966 int charset_ID;
1992 unsigned code; 1967 unsigned code;
1993 int c; 1968 int c;
1994 int consumed_chars = 0; 1969 int consumed_chars = 0;
@@ -1998,7 +1973,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
1998 if (c < 0) 1973 if (c < 0)
1999 { 1974 {
2000 c = -c; 1975 c = -c;
2001 charset_id = emacs_mule_charset[0]; 1976 charset_ID = emacs_mule_charset[0];
2002 } 1977 }
2003 else 1978 else
2004 { 1979 {
@@ -2034,7 +2009,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2034 switch (emacs_mule_bytes[c]) 2009 switch (emacs_mule_bytes[c])
2035 { 2010 {
2036 case 2: 2011 case 2:
2037 if ((charset_id = emacs_mule_charset[c]) < 0) 2012 if ((charset_ID = emacs_mule_charset[c]) < 0)
2038 goto invalid_code; 2013 goto invalid_code;
2039 ONE_MORE_BYTE (c); 2014 ONE_MORE_BYTE (c);
2040 if (c < 0xA0) 2015 if (c < 0xA0)
@@ -2047,7 +2022,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2047 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) 2022 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12)
2048 { 2023 {
2049 ONE_MORE_BYTE (c); 2024 ONE_MORE_BYTE (c);
2050 if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) 2025 if (c < 0xA0 || (charset_ID = emacs_mule_charset[c]) < 0)
2051 goto invalid_code; 2026 goto invalid_code;
2052 ONE_MORE_BYTE (c); 2027 ONE_MORE_BYTE (c);
2053 if (c < 0xA0) 2028 if (c < 0xA0)
@@ -2056,7 +2031,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2056 } 2031 }
2057 else 2032 else
2058 { 2033 {
2059 if ((charset_id = emacs_mule_charset[c]) < 0) 2034 if ((charset_ID = emacs_mule_charset[c]) < 0)
2060 goto invalid_code; 2035 goto invalid_code;
2061 ONE_MORE_BYTE (c); 2036 ONE_MORE_BYTE (c);
2062 if (c < 0xA0) 2037 if (c < 0xA0)
@@ -2071,7 +2046,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2071 2046
2072 case 4: 2047 case 4:
2073 ONE_MORE_BYTE (c); 2048 ONE_MORE_BYTE (c);
2074 if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) 2049 if (c < 0 || (charset_ID = emacs_mule_charset[c]) < 0)
2075 goto invalid_code; 2050 goto invalid_code;
2076 ONE_MORE_BYTE (c); 2051 ONE_MORE_BYTE (c);
2077 if (c < 0xA0) 2052 if (c < 0xA0)
@@ -2085,21 +2060,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2085 2060
2086 case 1: 2061 case 1:
2087 code = c; 2062 code = c;
2088 charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; 2063 charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit;
2089 break; 2064 break;
2090 2065
2091 default: 2066 default:
2092 abort (); 2067 abort ();
2093 } 2068 }
2094 CODING_DECODE_CHAR (coding, src, src_base, src_end, 2069 CODING_DECODE_CHAR (coding, src, src_base, src_end,
2095 CHARSET_FROM_ID (charset_id), code, c); 2070 CHARSET_FROM_ID (charset_ID), code, c);
2096 if (c < 0) 2071 if (c < 0)
2097 goto invalid_code; 2072 goto invalid_code;
2098 } 2073 }
2099 *nbytes = src - src_base; 2074 *nbytes = src - src_base;
2100 *nchars = consumed_chars; 2075 *nchars = consumed_chars;
2101 if (id) 2076 if (id)
2102 *id = charset_id; 2077 *id = charset_ID;
2103 return (mseq_found ? -c : c); 2078 return (mseq_found ? -c : c);
2104 2079
2105 no_more_source: 2080 no_more_source:
@@ -2372,7 +2347,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2372 int char_offset = coding->produced_char; 2347 int char_offset = coding->produced_char;
2373 int last_offset = char_offset; 2348 int last_offset = char_offset;
2374 int last_id = charset_ascii; 2349 int last_id = charset_ascii;
2375 int eol_crlf = 2350 int eol_dos =
2376 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 2351 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
2377 int byte_after_cr = -1; 2352 int byte_after_cr = -1;
2378 struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; 2353 struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status;
@@ -2390,7 +2365,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2390 2365
2391 while (1) 2366 while (1)
2392 { 2367 {
2393 int c, id; 2368 int c, id IF_LINT (= 0);
2394 2369
2395 src_base = src; 2370 src_base = src;
2396 consumed_chars_base = consumed_chars; 2371 consumed_chars_base = consumed_chars;
@@ -2422,7 +2397,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2422 2397
2423 if (c < 0x80) 2398 if (c < 0x80)
2424 { 2399 {
2425 if (eol_crlf && c == '\r') 2400 if (eol_dos && c == '\r')
2426 ONE_MORE_BYTE (byte_after_cr); 2401 ONE_MORE_BYTE (byte_after_cr);
2427 id = charset_ascii; 2402 id = charset_ascii;
2428 if (cmp_status->state != COMPOSING_NO) 2403 if (cmp_status->state != COMPOSING_NO)
@@ -2435,7 +2410,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2435 } 2410 }
2436 else 2411 else
2437 { 2412 {
2438 int nchars, nbytes; 2413 int nchars IF_LINT (= 0), nbytes IF_LINT (= 0);
2439 /* emacs_mule_char can load a charset map from a file, which 2414 /* emacs_mule_char can load a charset map from a file, which
2440 allocates a large structure and might cause buffer text 2415 allocates a large structure and might cause buffer text
2441 to be relocated as result. Thus, we need to remember the 2416 to be relocated as result. Thus, we need to remember the
@@ -2903,10 +2878,6 @@ enum iso_code_class_type iso_code_class[256];
2903 ((id) <= (coding)->max_charset_id \ 2878 ((id) <= (coding)->max_charset_id \
2904 && (coding)->safe_charsets[id] != 255) 2879 && (coding)->safe_charsets[id] != 255)
2905 2880
2906
2907#define SHIFT_OUT_OK(category) \
2908 (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0)
2909
2910static void 2881static void
2911setup_iso_safe_charsets (Lisp_Object attrs) 2882setup_iso_safe_charsets (Lisp_Object attrs)
2912{ 2883{
@@ -2983,7 +2954,12 @@ detect_coding_iso_2022 (struct coding_system *coding,
2983 const unsigned char *src_end = coding->source + coding->src_bytes; 2954 const unsigned char *src_end = coding->source + coding->src_bytes;
2984 int multibytep = coding->src_multibyte; 2955 int multibytep = coding->src_multibyte;
2985 int single_shifting = 0; 2956 int single_shifting = 0;
2986 int id; 2957
2958 /* FIXME: Does ID need to be initialized here? The "End of composition"
2959 code below does not initialize ID even though ID is used
2960 afterwards, and perhaps that is a bug. */
2961 int id = 0;
2962
2987 int c, c1; 2963 int c, c1;
2988 int consumed_chars = 0; 2964 int consumed_chars = 0;
2989 int i; 2965 int i;
@@ -3158,7 +3134,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
3158 if (! single_shifting 3134 if (! single_shifting
3159 && ! (rejected & CATEGORY_MASK_ISO_8_2)) 3135 && ! (rejected & CATEGORY_MASK_ISO_8_2))
3160 { 3136 {
3161 int i = 1; 3137 int len = 1;
3162 while (src < src_end) 3138 while (src < src_end)
3163 { 3139 {
3164 src_base = src; 3140 src_base = src;
@@ -3168,20 +3144,20 @@ detect_coding_iso_2022 (struct coding_system *coding,
3168 src = src_base; 3144 src = src_base;
3169 break; 3145 break;
3170 } 3146 }
3171 i++; 3147 len++;
3172 } 3148 }
3173 3149
3174 if (i & 1 && src < src_end) 3150 if (len & 1 && src < src_end)
3175 { 3151 {
3176 rejected |= CATEGORY_MASK_ISO_8_2; 3152 rejected |= CATEGORY_MASK_ISO_8_2;
3177 if (composition_count >= 0) 3153 if (composition_count >= 0)
3178 composition_count += i; 3154 composition_count += len;
3179 } 3155 }
3180 else 3156 else
3181 { 3157 {
3182 found |= CATEGORY_MASK_ISO_8_2; 3158 found |= CATEGORY_MASK_ISO_8_2;
3183 if (composition_count >= 0) 3159 if (composition_count >= 0)
3184 composition_count += i / 2; 3160 composition_count += len / 2;
3185 } 3161 }
3186 } 3162 }
3187 break; 3163 break;
@@ -3309,10 +3285,10 @@ detect_coding_iso_2022 (struct coding_system *coding,
3309 } \ 3285 } \
3310 else /* new format (after ver.21) */ \ 3286 else /* new format (after ver.21) */ \
3311 { \ 3287 { \
3312 int c; \ 3288 int b; \
3313 \ 3289 \
3314 ONE_MORE_BYTE (c); \ 3290 ONE_MORE_BYTE (b); \
3315 rule = COMPOSITION_ENCODE_RULE (rule - 81, c - 32); \ 3291 rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \
3316 if (rule >= 0) \ 3292 if (rule >= 0) \
3317 rule += 0x100; /* to destinguish it from the old format */ \ 3293 rule += 0x100; /* to destinguish it from the old format */ \
3318 nbytes = 2; \ 3294 nbytes = 2; \
@@ -3504,7 +3480,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3504 int char_offset = coding->produced_char; 3480 int char_offset = coding->produced_char;
3505 int last_offset = char_offset; 3481 int last_offset = char_offset;
3506 int last_id = charset_ascii; 3482 int last_id = charset_ascii;
3507 int eol_crlf = 3483 int eol_dos =
3508 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 3484 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
3509 int byte_after_cr = -1; 3485 int byte_after_cr = -1;
3510 int i; 3486 int i;
@@ -3624,7 +3600,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3624 break; 3600 break;
3625 3601
3626 case ISO_control_0: 3602 case ISO_control_0:
3627 if (eol_crlf && c1 == '\r') 3603 if (eol_dos && c1 == '\r')
3628 ONE_MORE_BYTE (byte_after_cr); 3604 ONE_MORE_BYTE (byte_after_cr);
3629 MAYBE_FINISH_COMPOSITION (); 3605 MAYBE_FINISH_COMPOSITION ();
3630 charset = CHARSET_FROM_ID (charset_ascii); 3606 charset = CHARSET_FROM_ID (charset_ascii);
@@ -3897,6 +3873,10 @@ decode_coding_iso_2022 (struct coding_system *coding)
3897 } 3873 }
3898 continue; 3874 continue;
3899 } 3875 }
3876 break;
3877
3878 default:
3879 abort ();
3900 } 3880 }
3901 3881
3902 if (cmp_status->state == COMPOSING_NO 3882 if (cmp_status->state == COMPOSING_NO
@@ -4029,7 +4009,6 @@ decode_coding_iso_2022 (struct coding_system *coding)
4029 const char *intermediate_char_94 = "()*+"; \ 4009 const char *intermediate_char_94 = "()*+"; \
4030 const char *intermediate_char_96 = ",-./"; \ 4010 const char *intermediate_char_96 = ",-./"; \
4031 int revision = -1; \ 4011 int revision = -1; \
4032 int c; \
4033 \ 4012 \
4034 if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \ 4013 if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \
4035 revision = CHARSET_ISO_REVISION (charset); \ 4014 revision = CHARSET_ISO_REVISION (charset); \
@@ -4042,11 +4021,12 @@ decode_coding_iso_2022 (struct coding_system *coding)
4042 EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \ 4021 EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \
4043 if (CHARSET_DIMENSION (charset) == 1) \ 4022 if (CHARSET_DIMENSION (charset) == 1) \
4044 { \ 4023 { \
4024 int b; \
4045 if (! CHARSET_ISO_CHARS_96 (charset)) \ 4025 if (! CHARSET_ISO_CHARS_96 (charset)) \
4046 c = intermediate_char_94[reg]; \ 4026 b = intermediate_char_94[reg]; \
4047 else \ 4027 else \
4048 c = intermediate_char_96[reg]; \ 4028 b = intermediate_char_96[reg]; \
4049 EMIT_ONE_ASCII_BYTE (c); \ 4029 EMIT_ONE_ASCII_BYTE (b); \
4050 } \ 4030 } \
4051 else \ 4031 else \
4052 { \ 4032 { \
@@ -4226,7 +4206,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
4226 to use CHARSET. The element `spec.iso_2022' of *CODING is updated. 4206 to use CHARSET. The element `spec.iso_2022' of *CODING is updated.
4227 Return new DST. */ 4207 Return new DST. */
4228 4208
4229unsigned char * 4209static unsigned char *
4230encode_invocation_designation (struct charset *charset, 4210encode_invocation_designation (struct charset *charset,
4231 struct coding_system *coding, 4211 struct coding_system *coding,
4232 unsigned char *dst, int *p_nchars) 4212 unsigned char *dst, int *p_nchars)
@@ -4289,30 +4269,6 @@ encode_invocation_designation (struct charset *charset,
4289 return dst; 4269 return dst;
4290} 4270}
4291 4271
4292/* The following three macros produce codes for indicating direction
4293 of text. */
4294#define ENCODE_CONTROL_SEQUENCE_INTRODUCER \
4295 do { \
4296 if (CODING_ISO_FLAGS (coding) == CODING_ISO_FLAG_SEVEN_BITS) \
4297 EMIT_TWO_ASCII_BYTES (ISO_CODE_ESC, '['); \
4298 else \
4299 EMIT_ONE_BYTE (ISO_CODE_CSI); \
4300 } while (0)
4301
4302
4303#define ENCODE_DIRECTION_R2L() \
4304 do { \
4305 ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \
4306 EMIT_TWO_ASCII_BYTES ('2', ']'); \
4307 } while (0)
4308
4309
4310#define ENCODE_DIRECTION_L2R() \
4311 do { \
4312 ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \
4313 EMIT_TWO_ASCII_BYTES ('0', ']'); \
4314 } while (0)
4315
4316 4272
4317/* Produce codes for designation and invocation to reset the graphic 4273/* Produce codes for designation and invocation to reset the graphic
4318 planes and registers to initial state. */ 4274 planes and registers to initial state. */
@@ -4707,7 +4663,7 @@ decode_coding_sjis (struct coding_system *coding)
4707 int char_offset = coding->produced_char; 4663 int char_offset = coding->produced_char;
4708 int last_offset = char_offset; 4664 int last_offset = char_offset;
4709 int last_id = charset_ascii; 4665 int last_id = charset_ascii;
4710 int eol_crlf = 4666 int eol_dos =
4711 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 4667 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
4712 int byte_after_cr = -1; 4668 int byte_after_cr = -1;
4713 4669
@@ -4742,7 +4698,7 @@ decode_coding_sjis (struct coding_system *coding)
4742 goto invalid_code; 4698 goto invalid_code;
4743 if (c < 0x80) 4699 if (c < 0x80)
4744 { 4700 {
4745 if (eol_crlf && c == '\r') 4701 if (eol_dos && c == '\r')
4746 ONE_MORE_BYTE (byte_after_cr); 4702 ONE_MORE_BYTE (byte_after_cr);
4747 charset = charset_roman; 4703 charset = charset_roman;
4748 } 4704 }
@@ -4824,7 +4780,7 @@ decode_coding_big5 (struct coding_system *coding)
4824 int char_offset = coding->produced_char; 4780 int char_offset = coding->produced_char;
4825 int last_offset = char_offset; 4781 int last_offset = char_offset;
4826 int last_id = charset_ascii; 4782 int last_id = charset_ascii;
4827 int eol_crlf = 4783 int eol_dos =
4828 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 4784 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
4829 int byte_after_cr = -1; 4785 int byte_after_cr = -1;
4830 4786
@@ -4857,7 +4813,7 @@ decode_coding_big5 (struct coding_system *coding)
4857 goto invalid_code; 4813 goto invalid_code;
4858 if (c < 0x80) 4814 if (c < 0x80)
4859 { 4815 {
4860 if (eol_crlf && c == '\r') 4816 if (eol_dos && c == '\r')
4861 ONE_MORE_BYTE (byte_after_cr); 4817 ONE_MORE_BYTE (byte_after_cr);
4862 charset = charset_roman; 4818 charset = charset_roman;
4863 } 4819 }
@@ -5261,13 +5217,13 @@ encode_coding_ccl (struct coding_system *coding)
5261static void 5217static void
5262decode_coding_raw_text (struct coding_system *coding) 5218decode_coding_raw_text (struct coding_system *coding)
5263{ 5219{
5264 int eol_crlf = 5220 int eol_dos =
5265 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 5221 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
5266 5222
5267 coding->chars_at_source = 1; 5223 coding->chars_at_source = 1;
5268 coding->consumed_char = coding->src_chars; 5224 coding->consumed_char = coding->src_chars;
5269 coding->consumed = coding->src_bytes; 5225 coding->consumed = coding->src_bytes;
5270 if (eol_crlf && coding->source[coding->src_bytes - 1] == '\r') 5226 if (eol_dos && coding->source[coding->src_bytes - 1] == '\r')
5271 { 5227 {
5272 coding->consumed_char--; 5228 coding->consumed_char--;
5273 coding->consumed--; 5229 coding->consumed--;
@@ -5480,7 +5436,7 @@ decode_coding_charset (struct coding_system *coding)
5480 int char_offset = coding->produced_char; 5436 int char_offset = coding->produced_char;
5481 int last_offset = char_offset; 5437 int last_offset = char_offset;
5482 int last_id = charset_ascii; 5438 int last_id = charset_ascii;
5483 int eol_crlf = 5439 int eol_dos =
5484 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 5440 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
5485 int byte_after_cr = -1; 5441 int byte_after_cr = -1;
5486 5442
@@ -5514,7 +5470,7 @@ decode_coding_charset (struct coding_system *coding)
5514 else 5470 else
5515 { 5471 {
5516 ONE_MORE_BYTE (c); 5472 ONE_MORE_BYTE (c);
5517 if (eol_crlf && c == '\r') 5473 if (eol_dos && c == '\r')
5518 ONE_MORE_BYTE (byte_after_cr); 5474 ONE_MORE_BYTE (byte_after_cr);
5519 } 5475 }
5520 if (c < 0) 5476 if (c < 0)
@@ -6607,15 +6563,15 @@ get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
6607 } 6563 }
6608 else if (CONSP (translation_table)) 6564 else if (CONSP (translation_table))
6609 { 6565 {
6610 Lisp_Object tail, val; 6566 Lisp_Object tail;
6611 6567
6612 for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) 6568 for (tail = translation_table; CONSP (tail); tail = XCDR (tail))
6613 if (CHAR_TABLE_P (XCAR (tail)) 6569 if (CHAR_TABLE_P (XCAR (tail))
6614 && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) 6570 && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1)
6615 { 6571 {
6616 val = XCHAR_TABLE (XCAR (tail))->extras[1]; 6572 Lisp_Object tailval = XCHAR_TABLE (XCAR (tail))->extras[1];
6617 if (NATNUMP (val) && *max_lookup < XFASTINT (val)) 6573 if (NATNUMP (tailval) && *max_lookup < XFASTINT (tailval))
6618 *max_lookup = XFASTINT (val); 6574 *max_lookup = XFASTINT (tailval);
6619 } 6575 }
6620 } 6576 }
6621 } 6577 }
@@ -7652,12 +7608,12 @@ decode_coding_object (struct coding_system *coding,
7652 Lisp_Object dst_object) 7608 Lisp_Object dst_object)
7653{ 7609{
7654 int count = SPECPDL_INDEX (); 7610 int count = SPECPDL_INDEX ();
7655 unsigned char *destination; 7611 unsigned char *destination IF_LINT (= NULL);
7656 EMACS_INT dst_bytes; 7612 EMACS_INT dst_bytes IF_LINT (= 0);
7657 EMACS_INT chars = to - from; 7613 EMACS_INT chars = to - from;
7658 EMACS_INT bytes = to_byte - from_byte; 7614 EMACS_INT bytes = to_byte - from_byte;
7659 Lisp_Object attrs; 7615 Lisp_Object attrs;
7660 int saved_pt = -1, saved_pt_byte; 7616 int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
7661 int need_marker_adjustment = 0; 7617 int need_marker_adjustment = 0;
7662 Lisp_Object old_deactivate_mark; 7618 Lisp_Object old_deactivate_mark;
7663 7619
@@ -7845,7 +7801,7 @@ encode_coding_object (struct coding_system *coding,
7845 EMACS_INT chars = to - from; 7801 EMACS_INT chars = to - from;
7846 EMACS_INT bytes = to_byte - from_byte; 7802 EMACS_INT bytes = to_byte - from_byte;
7847 Lisp_Object attrs; 7803 Lisp_Object attrs;
7848 int saved_pt = -1, saved_pt_byte; 7804 int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
7849 int need_marker_adjustment = 0; 7805 int need_marker_adjustment = 0;
7850 int kill_src_buffer = 0; 7806 int kill_src_buffer = 0;
7851 Lisp_Object old_deactivate_mark; 7807 Lisp_Object old_deactivate_mark;
@@ -8178,8 +8134,8 @@ detect_coding_system (const unsigned char *src,
8178 base_category = XINT (CODING_ATTR_CATEGORY (attrs)); 8134 base_category = XINT (CODING_ATTR_CATEGORY (attrs));
8179 if (base_category == coding_category_undecided) 8135 if (base_category == coding_category_undecided)
8180 { 8136 {
8181 enum coding_category category; 8137 enum coding_category category IF_LINT (= 0);
8182 struct coding_system *this; 8138 struct coding_system *this IF_LINT (= NULL);
8183 int c, i; 8139 int c, i;
8184 8140
8185 /* Skip all ASCII bytes except for a few ISO2022 controls. */ 8141 /* Skip all ASCII bytes except for a few ISO2022 controls. */
@@ -9112,10 +9068,10 @@ Return the corresponding character. */)
9112 } 9068 }
9113 else 9069 else
9114 { 9070 {
9115 int s1 = c >> 8, s2 = c & 0xFF; 9071 int c1 = c >> 8, c2 = c & 0xFF;
9116 9072
9117 if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF 9073 if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF
9118 || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) 9074 || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC)
9119 error ("Invalid code: %d", code); 9075 error ("Invalid code: %d", code);
9120 SJIS_TO_JIS (c); 9076 SJIS_TO_JIS (c);
9121 charset = charset_kanji; 9077 charset = charset_kanji;
@@ -9798,7 +9754,6 @@ usage: (define-coding-system-internal ...) */)
9798 else if (EQ (coding_type, Qiso_2022)) 9754 else if (EQ (coding_type, Qiso_2022))
9799 { 9755 {
9800 Lisp_Object initial, reg_usage, request, flags; 9756 Lisp_Object initial, reg_usage, request, flags;
9801 int i;
9802 9757
9803 if (nargs < coding_arg_iso2022_max) 9758 if (nargs < coding_arg_iso2022_max)
9804 goto short_args; 9759 goto short_args;
@@ -9830,12 +9785,12 @@ usage: (define-coding-system-internal ...) */)
9830 for (tail = request; ! NILP (tail); tail = Fcdr (tail)) 9785 for (tail = request; ! NILP (tail); tail = Fcdr (tail))
9831 { 9786 {
9832 int id; 9787 int id;
9833 Lisp_Object tmp; 9788 Lisp_Object tmp1;
9834 9789
9835 val = Fcar (tail); 9790 val = Fcar (tail);
9836 CHECK_CONS (val); 9791 CHECK_CONS (val);
9837 tmp = XCAR (val); 9792 tmp1 = XCAR (val);
9838 CHECK_CHARSET_GET_ID (tmp, id); 9793 CHECK_CHARSET_GET_ID (tmp1, id);
9839 CHECK_NATNUM_CDR (val); 9794 CHECK_NATNUM_CDR (val);
9840 if (XINT (XCDR (val)) >= 4) 9795 if (XINT (XCDR (val)) >= 4)
9841 error ("Invalid graphic register number: %d", XINT (XCDR (val))); 9796 error ("Invalid graphic register number: %d", XINT (XCDR (val)));
diff --git a/src/config.in b/src/config.in
index 8889213b781..fbd3ee9338d 100644
--- a/src/config.in
+++ b/src/config.in
@@ -1206,6 +1206,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1206# define __restrict__ 1206# define __restrict__
1207#endif 1207#endif
1208 1208
1209/* Define to `unsigned int' if <sys/types.h> does not define. */
1210#undef size_t
1211
1209/* Define to any substitute for sys_siglist. */ 1212/* Define to any substitute for sys_siglist. */
1210#undef sys_siglist 1213#undef sys_siglist
1211 1214
diff --git a/src/deps.mk b/src/deps.mk
index 77994bcaadb..2b162b07bb8 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -190,13 +190,13 @@ sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
190term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ 190term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \
191 cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ 191 cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \
192 xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ 192 xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \
193 systty.h syssignal.h $(INTERVALS_H) buffer.h ../lib/unistd.h 193 systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h
194termcap.o: termcap.c lisp.h $(config_h) 194termcap.o: termcap.c lisp.h $(config_h)
195terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ 195terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
196 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ 196 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \
197 msdos.h 197 msdos.h
198terminfo.o: terminfo.c lisp.h globals.h $(config_h) 198terminfo.o: terminfo.c lisp.h globals.h $(config_h)
199tparam.o: tparam.c lisp.h $(config_h) 199tparam.o: tparam.c tparam.h lisp.h $(config_h)
200undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ 200undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \
201 lisp.h globals.h $(config_h) 201 lisp.h globals.h $(config_h)
202unexaix.o: unexaix.c lisp.h $(config_h) 202unexaix.o: unexaix.c lisp.h $(config_h)
diff --git a/src/dispextern.h b/src/dispextern.h
index 37ae7ee5fd5..9843dfd1fcd 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2944,6 +2944,7 @@ enum tool_bar_item_image
2944 2944
2945extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *); 2945extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *);
2946extern void bidi_move_to_visually_next (struct bidi_it *); 2946extern void bidi_move_to_visually_next (struct bidi_it *);
2947extern void bidi_dump_cached_states (void);
2947extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int); 2948extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
2948extern int bidi_mirror_char (int); 2949extern int bidi_mirror_char (int);
2949 2950
@@ -3325,9 +3326,10 @@ extern struct terminal *init_tty (const char *, const char *, int);
3325 3326
3326extern int scrolling_max_lines_saved (int, int, int *, int *, int *); 3327extern int scrolling_max_lines_saved (int, int, int *, int *, int *);
3327extern int scroll_cost (struct frame *, int, int, int); 3328extern int scroll_cost (struct frame *, int, int, int);
3328extern void do_line_insertion_deletion_costs (struct frame *, char *, 3329extern void do_line_insertion_deletion_costs (struct frame *, const char *,
3329 char *, char *, char *, 3330 const char *, const char *,
3330 char *, char *, int); 3331 const char *, const char *,
3332 const char *, int);
3331void scrolling_1 (struct frame *, int, int, int, int *, int *, int *, 3333void scrolling_1 (struct frame *, int, int, int, int *, int *, int *,
3332 int *, int); 3334 int *, int);
3333 3335
diff --git a/src/fontset.c b/src/fontset.c
index f297fd10a71..b5d8a0db434 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -233,14 +233,14 @@ fontset_id_valid_p (int id)
233/* Macros to access special values of (base) FONTSET. */ 233/* Macros to access special values of (base) FONTSET. */
234#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] 234#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
235#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] 235#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
236#define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] 236/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */
237 237
238/* Macros to access special values of (realized) FONTSET. */ 238/* Macros to access special values of (realized) FONTSET. */
239#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] 239#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
240#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] 240#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
241#define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] 241#define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4]
242#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] 242#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
243#define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] 243/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */
244#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] 244#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
245 245
246/* For both base and realized fontset. */ 246/* For both base and realized fontset. */
@@ -266,7 +266,6 @@ fontset_id_valid_p (int id)
266 ASET ((rfont_def), 0, make_number (face_id)) 266 ASET ((rfont_def), 0, make_number (face_id))
267#define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1) 267#define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1)
268#define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1)) 268#define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1))
269#define RFONT_DEF_REPERTORY(rfont_def) FONT_DEF_REPERTORY (AREF (rfont_def, 1))
270#define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) 269#define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2)
271#define RFONT_DEF_SET_OBJECT(rfont_def, object) \ 270#define RFONT_DEF_SET_OBJECT(rfont_def, object) \
272 ASET ((rfont_def), 2, (object)) 271 ASET ((rfont_def), 2, (object))
@@ -713,7 +712,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa
713static Lisp_Object 712static Lisp_Object
714fontset_font (Lisp_Object fontset, int c, struct face *face, int id) 713fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
715{ 714{
716 Lisp_Object rfont_def, default_rfont_def; 715 Lisp_Object rfont_def, default_rfont_def IF_LINT (= Qnil);
717 Lisp_Object base_fontset; 716 Lisp_Object base_fontset;
718 717
719 /* Try a font-group of FONTSET. */ 718 /* Try a font-group of FONTSET. */
@@ -836,7 +835,7 @@ fontset_ascii (int id)
836 return elt; 835 return elt;
837} 836}
838 837
839void 838static void
840free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) 839free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
841{ 840{
842 Lisp_Object tail; 841 Lisp_Object tail;
@@ -1583,14 +1582,14 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1583 1582
1584 if (ascii_changed) 1583 if (ascii_changed)
1585 { 1584 {
1586 Lisp_Object tail, frame, alist; 1585 Lisp_Object tail, fr, alist;
1587 int fontset_id = XINT (FONTSET_ID (fontset)); 1586 int fontset_id = XINT (FONTSET_ID (fontset));
1588 1587
1589 FONTSET_ASCII (fontset) = fontname; 1588 FONTSET_ASCII (fontset) = fontname;
1590 name = FONTSET_NAME (fontset); 1589 name = FONTSET_NAME (fontset);
1591 FOR_EACH_FRAME (tail, frame) 1590 FOR_EACH_FRAME (tail, fr)
1592 { 1591 {
1593 FRAME_PTR f = XFRAME (frame); 1592 FRAME_PTR f = XFRAME (fr);
1594 Lisp_Object font_object; 1593 Lisp_Object font_object;
1595 struct face *face; 1594 struct face *face;
1596 1595
@@ -1607,7 +1606,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1607 { 1606 {
1608 update_auto_fontset_alist (font_object, fontset); 1607 update_auto_fontset_alist (font_object, fontset);
1609 alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil); 1608 alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil);
1610 Fmodify_frame_parameters (frame, alist); 1609 Fmodify_frame_parameters (fr, alist);
1611 } 1610 }
1612 } 1611 }
1613 } 1612 }
diff --git a/src/fringe.c b/src/fringe.c
index d42d6467f31..82fc38aee8a 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -913,7 +913,12 @@ update_window_fringes (struct window *w, int keep_current_p)
913 int bitmap_cache[MAX_BITMAP_CACHE]; 913 int bitmap_cache[MAX_BITMAP_CACHE];
914 int top_ind_rn, bot_ind_rn; 914 int top_ind_rn, bot_ind_rn;
915 int top_ind_min_y, bot_ind_max_y; 915 int top_ind_min_y, bot_ind_max_y;
916 int top_row_ends_at_zv_p, bot_row_ends_at_zv_p; 916
917 /* top_ind_rn is set to a nonnegative value whenver
918 row->indicate_bob_p is set, so it's OK that top_row_ends_at_zv_p
919 is not initialized here. Similarly for bot_ind_rn,
920 row->indicate_eob_p and bot_row_ends_at_zv_p. */
921 int top_row_ends_at_zv_p IF_LINT (= 0), bot_row_ends_at_zv_p IF_LINT (= 0);
917 922
918 if (w->pseudo_window_p) 923 if (w->pseudo_window_p)
919 return 0; 924 return 0;
@@ -1380,7 +1385,7 @@ compute_fringe_widths (struct frame *f, int redraw)
1380 1385
1381/* Free resources used by a user-defined bitmap. */ 1386/* Free resources used by a user-defined bitmap. */
1382 1387
1383void 1388static void
1384destroy_fringe_bitmap (int n) 1389destroy_fringe_bitmap (int n)
1385{ 1390{
1386 struct fringe_bitmap **fbp; 1391 struct fringe_bitmap **fbp;
@@ -1448,7 +1453,7 @@ static const unsigned char swap_nibble[16] = {
1448 0x3, 0xb, 0x7, 0xf}; /* 0011 1011 0111 1111 */ 1453 0x3, 0xb, 0x7, 0xf}; /* 0011 1011 0111 1111 */
1449#endif /* HAVE_X_WINDOWS */ 1454#endif /* HAVE_X_WINDOWS */
1450 1455
1451void 1456static void
1452init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p) 1457init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
1453{ 1458{
1454 if (once_p || fb->dynamic) 1459 if (once_p || fb->dynamic)
@@ -1831,4 +1836,3 @@ w32_reset_fringes (void)
1831#endif /* HAVE_NTGUI */ 1836#endif /* HAVE_NTGUI */
1832 1837
1833#endif /* HAVE_WINDOW_SYSTEM */ 1838#endif /* HAVE_WINDOW_SYSTEM */
1834
diff --git a/src/lisp.h b/src/lisp.h
index e38d6a8ec3c..113585320af 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2150,12 +2150,15 @@ struct gcpro
2150 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) 2150 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
2151 2151
2152 2152
2153#define GCPRO1(varname) GCPRO1_VAR (varname, gcpro1)
2154#define UNGCPRO UNGCPRO_VAR (gcpro1)
2155
2153#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS 2156#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
2154 2157
2155/* Do something silly with gcproN vars just so gcc shuts up. */ 2158/* Do something silly with gcproN vars just so gcc shuts up. */
2156/* You get warnings from MIPSPro... */ 2159/* You get warnings from MIPSPro... */
2157 2160
2158#define GCPRO1(varname) ((void) gcpro1) 2161#define GCPRO1_VAR(varname, gcpro1) ((void) gcpro1)
2159#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1)) 2162#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1))
2160#define GCPRO3(varname1, varname2, varname3) \ 2163#define GCPRO3(varname1, varname2, varname3) \
2161 (((void) gcpro3, (void) gcpro2, (void) gcpro1)) 2164 (((void) gcpro3, (void) gcpro2, (void) gcpro1))
@@ -2165,13 +2168,13 @@ struct gcpro
2165 (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) 2168 (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
2166#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ 2169#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \
2167 (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) 2170 (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1))
2168#define UNGCPRO ((void) 0) 2171#define UNGCPRO_VAR(gcpro1) ((void) 0)
2169 2172
2170#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ 2173#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
2171 2174
2172#ifndef DEBUG_GCPRO 2175#ifndef DEBUG_GCPRO
2173 2176
2174#define GCPRO1(varname) \ 2177#define GCPRO1_VAR(varname, gcpro1) \
2175 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ 2178 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
2176 gcprolist = &gcpro1; } 2179 gcprolist = &gcpro1; }
2177 2180
@@ -2210,13 +2213,13 @@ struct gcpro
2210 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ 2213 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \
2211 gcprolist = &gcpro6; } 2214 gcprolist = &gcpro6; }
2212 2215
2213#define UNGCPRO (gcprolist = gcpro1.next) 2216#define UNGCPRO_VAR(gcpro1) (gcprolist = gcpro1.next)
2214 2217
2215#else 2218#else
2216 2219
2217extern int gcpro_level; 2220extern int gcpro_level;
2218 2221
2219#define GCPRO1(varname) \ 2222#define GCPRO1_VAR(varname, gcpro1) \
2220 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ 2223 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
2221 gcpro1.level = gcpro_level++; \ 2224 gcpro1.level = gcpro_level++; \
2222 gcprolist = &gcpro1; } 2225 gcprolist = &gcpro1; }
@@ -2266,7 +2269,7 @@ extern int gcpro_level;
2266 gcpro6.level = gcpro_level++; \ 2269 gcpro6.level = gcpro_level++; \
2267 gcprolist = &gcpro6; } 2270 gcprolist = &gcpro6; }
2268 2271
2269#define UNGCPRO \ 2272#define UNGCPRO_VAR(gcpro1) \
2270 ((--gcpro_level != gcpro1.level) \ 2273 ((--gcpro_level != gcpro1.level) \
2271 ? (abort (), 0) \ 2274 ? (abort (), 0) \
2272 : ((gcprolist = gcpro1.next), 0)) 2275 : ((gcprolist = gcpro1.next), 0))
@@ -2537,7 +2540,10 @@ extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y);
2537/* Defined in fringe.c */ 2540/* Defined in fringe.c */
2538extern void syms_of_fringe (void); 2541extern void syms_of_fringe (void);
2539extern void init_fringe (void); 2542extern void init_fringe (void);
2543#ifdef HAVE_WINDOW_SYSTEM
2544extern void mark_fringe_data (void);
2540extern void init_fringe_once (void); 2545extern void init_fringe_once (void);
2546#endif /* HAVE_WINDOW_SYSTEM */
2541 2547
2542/* Defined in image.c */ 2548/* Defined in image.c */
2543extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; 2549extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
@@ -3378,6 +3384,7 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
3378 3384
3379/* Defined in term.c */ 3385/* Defined in term.c */
3380extern int *char_ins_del_vector; 3386extern int *char_ins_del_vector;
3387extern void mark_ttys (void);
3381extern void syms_of_term (void); 3388extern void syms_of_term (void);
3382extern void fatal (const char *msgid, ...) NO_RETURN; 3389extern void fatal (const char *msgid, ...) NO_RETURN;
3383 3390
@@ -3524,6 +3531,13 @@ extern void init_system_name (void);
3524 && (circular_list_error ((list)), 1))) \ 3531 && (circular_list_error ((list)), 1))) \
3525 : 0))) 3532 : 0)))
3526 3533
3534/* Use this to suppress gcc's `...may be used before initialized' warnings. */
3535#ifdef lint
3536# define IF_LINT(Code) Code
3537#else
3538# define IF_LINT(Code) /* empty */
3539#endif
3540
3527/* The ubiquitous min and max macros. */ 3541/* The ubiquitous min and max macros. */
3528 3542
3529#ifdef max 3543#ifdef max
diff --git a/src/scroll.c b/src/scroll.c
index 1343b89c41e..33af18d2090 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -938,8 +938,8 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int
938 938
939static void 939static void
940ins_del_costs (FRAME_PTR frame, 940ins_del_costs (FRAME_PTR frame,
941 char *one_line_string, char *multi_string, 941 const char *one_line_string, const char *multi_string,
942 char *setup_string, char *cleanup_string, 942 const char *setup_string, const char *cleanup_string,
943 int *costvec, int *ncostvec, 943 int *costvec, int *ncostvec,
944 int coefficient) 944 int coefficient)
945{ 945{
@@ -994,9 +994,12 @@ ins_del_costs (FRAME_PTR frame,
994 994
995void 995void
996do_line_insertion_deletion_costs (FRAME_PTR frame, 996do_line_insertion_deletion_costs (FRAME_PTR frame,
997 char *ins_line_string, char *multi_ins_string, 997 const char *ins_line_string,
998 char *del_line_string, char *multi_del_string, 998 const char *multi_ins_string,
999 char *setup_string, char *cleanup_string, 999 const char *del_line_string,
1000 const char *multi_del_string,
1001 const char *setup_string,
1002 const char *cleanup_string,
1000 int coefficient) 1003 int coefficient)
1001{ 1004{
1002 if (FRAME_INSERT_COST (frame) != 0) 1005 if (FRAME_INSERT_COST (frame) != 0)
diff --git a/src/term.c b/src/term.c
index f082bb40e89..e78e2e68814 100644
--- a/src/term.c
+++ b/src/term.c
@@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32#include "lisp.h" 32#include "lisp.h"
33#include "termchar.h" 33#include "termchar.h"
34#include "termopts.h" 34#include "termopts.h"
35#include "tparam.h"
35#include "buffer.h" 36#include "buffer.h"
36#include "character.h" 37#include "character.h"
37#include "charset.h" 38#include "charset.h"
@@ -53,18 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
53static int been_here = -1; 54static int been_here = -1;
54#endif 55#endif
55 56
56/* For now, don't try to include termcap.h. On some systems,
57 configure finds a non-standard termcap.h that the main build
58 won't find. */
59extern void tputs (const char *, int, int (*)(int));
60extern int tgetent (char *, const char *);
61extern int tgetflag (char *id);
62extern int tgetnum (char *id);
63
64char *tparam (char *, char *, int, int, ...);
65
66extern char *tgetstr (char *, char **);
67
68#include "cm.h" 57#include "cm.h"
69#ifdef HAVE_X_WINDOWS 58#ifdef HAVE_X_WINDOWS
70#include "xterm.h" 59#include "xterm.h"
@@ -262,7 +251,7 @@ tty_set_scroll_region (struct frame *f, int start, int stop)
262 struct tty_display_info *tty = FRAME_TTY (f); 251 struct tty_display_info *tty = FRAME_TTY (f);
263 252
264 if (tty->TS_set_scroll_region) 253 if (tty->TS_set_scroll_region)
265 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1); 254 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0);
266 else if (tty->TS_set_scroll_region_1) 255 else if (tty->TS_set_scroll_region_1)
267 buf = tparam (tty->TS_set_scroll_region_1, 0, 0, 256 buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
268 FRAME_LINES (f), start, 257 FRAME_LINES (f), start,
@@ -512,7 +501,7 @@ static int encode_terminal_dst_size;
512 Set CODING->produced to the byte-length of the resulting byte 501 Set CODING->produced to the byte-length of the resulting byte
513 sequence, and return a pointer to that byte sequence. */ 502 sequence, and return a pointer to that byte sequence. */
514 503
515unsigned char * 504static unsigned char *
516encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) 505encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding)
517{ 506{
518 struct glyph *src_end = src + src_len; 507 struct glyph *src_end = src + src_len;
@@ -544,8 +533,8 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
544 { 533 {
545 if (src->type == COMPOSITE_GLYPH) 534 if (src->type == COMPOSITE_GLYPH)
546 { 535 {
547 struct composition *cmp; 536 struct composition *cmp IF_LINT (= NULL);
548 Lisp_Object gstring; 537 Lisp_Object gstring IF_LINT (= Qnil);
549 int i; 538 int i;
550 539
551 nbytes = buf - encode_terminal_src; 540 nbytes = buf - encode_terminal_src;
@@ -606,7 +595,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
606 else if (! CHAR_GLYPH_PADDING_P (*src)) 595 else if (! CHAR_GLYPH_PADDING_P (*src))
607 { 596 {
608 GLYPH g; 597 GLYPH g;
609 int c; 598 int c IF_LINT (= 0);
610 Lisp_Object string; 599 Lisp_Object string;
611 600
612 string = Qnil; 601 string = Qnil;
@@ -664,8 +653,6 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
664 } 653 }
665 else 654 else
666 { 655 {
667 unsigned char *p = SDATA (string);
668
669 if (! STRING_MULTIBYTE (string)) 656 if (! STRING_MULTIBYTE (string))
670 string = string_to_multibyte (string); 657 string = string_to_multibyte (string);
671 nbytes = buf - encode_terminal_src; 658 nbytes = buf - encode_terminal_src;
@@ -861,7 +848,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
861 848
862 if (tty->TS_ins_multi_chars) 849 if (tty->TS_ins_multi_chars)
863 { 850 {
864 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len); 851 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len, 0, 0, 0);
865 OUTPUT1 (tty, buf); 852 OUTPUT1 (tty, buf);
866 xfree (buf); 853 xfree (buf);
867 if (start) 854 if (start)
@@ -957,7 +944,7 @@ tty_delete_glyphs (struct frame *f, int n)
957 944
958 if (tty->TS_del_multi_chars) 945 if (tty->TS_del_multi_chars)
959 { 946 {
960 buf = tparam (tty->TS_del_multi_chars, 0, 0, n); 947 buf = tparam (tty->TS_del_multi_chars, 0, 0, n, 0, 0, 0);
961 OUTPUT1 (tty, buf); 948 OUTPUT1 (tty, buf);
962 xfree (buf); 949 xfree (buf);
963 } 950 }
@@ -974,9 +961,10 @@ static void
974tty_ins_del_lines (struct frame *f, int vpos, int n) 961tty_ins_del_lines (struct frame *f, int vpos, int n)
975{ 962{
976 struct tty_display_info *tty = FRAME_TTY (f); 963 struct tty_display_info *tty = FRAME_TTY (f);
977 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; 964 const char *multi =
978 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; 965 n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
979 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; 966 const char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
967 const char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
980 968
981 register int i = n > 0 ? n : -n; 969 register int i = n > 0 ? n : -n;
982 register char *buf; 970 register char *buf;
@@ -999,7 +987,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
999 { 987 {
1000 raw_cursor_to (f, vpos, 0); 988 raw_cursor_to (f, vpos, 0);
1001 tty_background_highlight (tty); 989 tty_background_highlight (tty);
1002 buf = tparam (multi, 0, 0, i); 990 buf = tparam (multi, 0, 0, i, 0, 0, 0);
1003 OUTPUT (tty, buf); 991 OUTPUT (tty, buf);
1004 xfree (buf); 992 xfree (buf);
1005 } 993 }
@@ -1151,9 +1139,9 @@ calculate_costs (struct frame *frame)
1151 if (FRAME_TERMCAP_P (frame)) 1139 if (FRAME_TERMCAP_P (frame))
1152 { 1140 {
1153 struct tty_display_info *tty = FRAME_TTY (frame); 1141 struct tty_display_info *tty = FRAME_TTY (frame);
1154 register char *f = (tty->TS_set_scroll_region 1142 register const char *f = (tty->TS_set_scroll_region
1155 ? tty->TS_set_scroll_region 1143 ? tty->TS_set_scroll_region
1156 : tty->TS_set_scroll_region_1); 1144 : tty->TS_set_scroll_region_1);
1157 1145
1158 FRAME_SCROLL_REGION_COST (frame) = string_cost (f); 1146 FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
1159 1147
@@ -1207,7 +1195,7 @@ calculate_costs (struct frame *frame)
1207} 1195}
1208 1196
1209struct fkey_table { 1197struct fkey_table {
1210 char *cap, *name; 1198 const char *cap, *name;
1211}; 1199};
1212 1200
1213 /* Termcap capability names that correspond directly to X keysyms. 1201 /* Termcap capability names that correspond directly to X keysyms.
@@ -1365,9 +1353,9 @@ term_get_fkeys_1 (void)
1365 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. 1353 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
1366 */ 1354 */
1367 { 1355 {
1368 char *k_semi = tgetstr ("k;", address); 1356 const char *k_semi = tgetstr ("k;", address);
1369 char *k0 = tgetstr ("k0", address); 1357 const char *k0 = tgetstr ("k0", address);
1370 char *k0_name = "f10"; 1358 const char *k0_name = "f10";
1371 1359
1372 if (k_semi) 1360 if (k_semi)
1373 { 1361 {
@@ -1460,7 +1448,7 @@ static void append_glyph (struct it *);
1460static void produce_stretch_glyph (struct it *); 1448static void produce_stretch_glyph (struct it *);
1461static void append_composite_glyph (struct it *); 1449static void append_composite_glyph (struct it *);
1462static void produce_composite_glyph (struct it *); 1450static void produce_composite_glyph (struct it *);
1463static void append_glyphless_glyph (struct it *, int, char *); 1451static void append_glyphless_glyph (struct it *, int, const char *);
1464static void produce_glyphless_glyph (struct it *, int, Lisp_Object); 1452static void produce_glyphless_glyph (struct it *, int, Lisp_Object);
1465 1453
1466/* Append glyphs to IT's glyph_row. Called from produce_glyphs for 1454/* Append glyphs to IT's glyph_row. Called from produce_glyphs for
@@ -1828,7 +1816,7 @@ produce_composite_glyph (struct it *it)
1828 comes from it->nglyphs bytes). */ 1816 comes from it->nglyphs bytes). */
1829 1817
1830static void 1818static void
1831append_glyphless_glyph (struct it *it, int face_id, char *str) 1819append_glyphless_glyph (struct it *it, int face_id, const char *str)
1832{ 1820{
1833 struct glyph *glyph, *end; 1821 struct glyph *glyph, *end;
1834 int i; 1822 int i;
@@ -1903,7 +1891,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1903{ 1891{
1904 int face_id; 1892 int face_id;
1905 int len; 1893 int len;
1906 char buf[9], *str = " "; 1894 char buf[9];
1895 char const *str = " ";
1907 1896
1908 /* Get a face ID for the glyph by utilizing a cache (the same way as 1897 /* Get a face ID for the glyph by utilizing a cache (the same way as
1909 done for `escape-glyph' in get_next_display_element). */ 1898 done for `escape-glyph' in get_next_display_element). */
@@ -2122,12 +2111,13 @@ turn_on_face (struct frame *f, int face_id)
2122 2111
2123 if (tty->TN_max_colors > 0) 2112 if (tty->TN_max_colors > 0)
2124 { 2113 {
2125 char *ts, *p; 2114 const char *ts;
2115 char *p;
2126 2116
2127 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; 2117 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
2128 if (fg >= 0 && ts) 2118 if (fg >= 0 && ts)
2129 { 2119 {
2130 p = tparam (ts, NULL, 0, (int) fg); 2120 p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0);
2131 OUTPUT (tty, p); 2121 OUTPUT (tty, p);
2132 xfree (p); 2122 xfree (p);
2133 } 2123 }
@@ -2135,7 +2125,7 @@ turn_on_face (struct frame *f, int face_id)
2135 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; 2125 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background;
2136 if (bg >= 0 && ts) 2126 if (bg >= 0 && ts)
2137 { 2127 {
2138 p = tparam (ts, NULL, 0, (int) bg); 2128 p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0);
2139 OUTPUT (tty, p); 2129 OUTPUT (tty, p);
2140 xfree (p); 2130 xfree (p);
2141 } 2131 }
@@ -2698,14 +2688,14 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
2698 Set *bar_window to Qnil, and *x and *y to the column and 2688 Set *bar_window to Qnil, and *x and *y to the column and
2699 row of the character cell the mouse is over. 2689 row of the character cell the mouse is over.
2700 2690
2701 Set *time to the time the mouse was at the returned position. 2691 Set *timeptr to the time the mouse was at the returned position.
2702 2692
2703 This clears mouse_moved until the next motion 2693 This clears mouse_moved until the next motion
2704 event arrives. */ 2694 event arrives. */
2705static void 2695static void
2706term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 2696term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2707 enum scroll_bar_part *part, Lisp_Object *x, 2697 enum scroll_bar_part *part, Lisp_Object *x,
2708 Lisp_Object *y, unsigned long *time) 2698 Lisp_Object *y, unsigned long *timeptr)
2709{ 2699{
2710 struct timeval now; 2700 struct timeval now;
2711 2701
@@ -2718,7 +2708,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2718 XSETINT (*x, last_mouse_x); 2708 XSETINT (*x, last_mouse_x);
2719 XSETINT (*y, last_mouse_y); 2709 XSETINT (*y, last_mouse_y);
2720 gettimeofday(&now, 0); 2710 gettimeofday(&now, 0);
2721 *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); 2711 *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000);
2722} 2712}
2723 2713
2724/* Prepare a mouse-event in *RESULT for placement in the input queue. 2714/* Prepare a mouse-event in *RESULT for placement in the input queue.
@@ -3532,10 +3522,10 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3532 If it were in the termcap entry, it would confuse other programs. */ 3522 If it were in the termcap entry, it would confuse other programs. */
3533 if (!tty->TS_set_window) 3523 if (!tty->TS_set_window)
3534 { 3524 {
3535 p = tty->TS_termcap_modes; 3525 const char *m = tty->TS_termcap_modes;
3536 while (*p && strcmp (p, "\033v ")) 3526 while (*m && strcmp (m, "\033v "))
3537 p++; 3527 m++;
3538 if (*p) 3528 if (*m)
3539 tty->TS_set_window = "\033v%C %C %C %C "; 3529 tty->TS_set_window = "\033v%C %C %C %C ";
3540 } 3530 }
3541 /* Termcap entry often fails to have :in: flag */ 3531 /* Termcap entry often fails to have :in: flag */
diff --git a/src/termchar.h b/src/termchar.h
index 277a96932b4..035974a8ce6 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -84,58 +84,58 @@ struct tty_display_info
84 84
85 /* Strings, numbers and flags taken from the termcap entry. */ 85 /* Strings, numbers and flags taken from the termcap entry. */
86 86
87 char *TS_ins_line; /* "al" */ 87 const char *TS_ins_line; /* "al" */
88 char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ 88 const char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
89 char *TS_bell; /* "bl" */ 89 const char *TS_bell; /* "bl" */
90 char *TS_clr_to_bottom; /* "cd" */ 90 const char *TS_clr_to_bottom; /* "cd" */
91 char *TS_clr_line; /* "ce", clear to end of line */ 91 const char *TS_clr_line; /* "ce", clear to end of line */
92 char *TS_clr_frame; /* "cl" */ 92 const char *TS_clr_frame; /* "cl" */
93 char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ 93 const char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
94 char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, 94 const char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
95 lines above scroll region, lines below it, 95 lines above scroll region, lines below it,
96 total lines again) */ 96 total lines again) */
97 char *TS_del_char; /* "dc" */ 97 const char *TS_del_char; /* "dc" */
98 char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ 98 const char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */
99 char *TS_del_line; /* "dl" */ 99 const char *TS_del_line; /* "dl" */
100 char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ 100 const char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */
101 char *TS_delete_mode; /* "dm", enter character-delete mode */ 101 const char *TS_delete_mode; /* "dm", enter character-delete mode */
102 char *TS_end_delete_mode; /* "ed", leave character-delete mode */ 102 const char *TS_end_delete_mode; /* "ed", leave character-delete mode */
103 char *TS_end_insert_mode; /* "ei", leave character-insert mode */ 103 const char *TS_end_insert_mode; /* "ei", leave character-insert mode */
104 char *TS_ins_char; /* "ic" */ 104 const char *TS_ins_char; /* "ic" */
105 char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ 105 const char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */
106 char *TS_insert_mode; /* "im", enter character-insert mode */ 106 const char *TS_insert_mode; /* "im", enter character-insert mode */
107 char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ 107 const char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */
108 char *TS_end_keypad_mode; /* "ke" */ 108 const char *TS_end_keypad_mode; /* "ke" */
109 char *TS_keypad_mode; /* "ks" */ 109 const char *TS_keypad_mode; /* "ks" */
110 char *TS_pad_char; /* "pc", char to use as padding */ 110 const char *TS_pad_char; /* "pc", char to use as padding */
111 char *TS_repeat; /* "rp" (2 params, # times to repeat 111 const char *TS_repeat; /* "rp" (2 params, # times to repeat
112 and character to be repeated) */ 112 and character to be repeated) */
113 char *TS_end_standout_mode; /* "se" */ 113 const char *TS_end_standout_mode; /* "se" */
114 char *TS_fwd_scroll; /* "sf" */ 114 const char *TS_fwd_scroll; /* "sf" */
115 char *TS_standout_mode; /* "so" */ 115 const char *TS_standout_mode; /* "so" */
116 char *TS_rev_scroll; /* "sr" */ 116 const char *TS_rev_scroll; /* "sr" */
117 char *TS_end_termcap_modes; /* "te" */ 117 const char *TS_end_termcap_modes; /* "te" */
118 char *TS_termcap_modes; /* "ti" */ 118 const char *TS_termcap_modes; /* "ti" */
119 char *TS_visible_bell; /* "vb" */ 119 const char *TS_visible_bell; /* "vb" */
120 char *TS_cursor_normal; /* "ve" */ 120 const char *TS_cursor_normal; /* "ve" */
121 char *TS_cursor_visible; /* "vs" */ 121 const char *TS_cursor_visible; /* "vs" */
122 char *TS_cursor_invisible; /* "vi" */ 122 const char *TS_cursor_invisible; /* "vi" */
123 char *TS_set_window; /* "wi" (4 params, start and end of window, 123 const char *TS_set_window; /* "wi" (4 params, start and end of window,
124 each as vpos and hpos) */ 124 each as vpos and hpos) */
125 125
126 char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ 126 const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
127 char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ 127 const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
128 char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ 128 const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
129 char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ 129 const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
130 char *TS_exit_underline_mode; /* "us" -- start underlining. */ 130 const char *TS_exit_underline_mode; /* "us" -- start underlining. */
131 char *TS_enter_underline_mode; /* "ue" -- end underlining. */ 131 const char *TS_enter_underline_mode; /* "ue" -- end underlining. */
132 132
133 /* "as"/"ae" -- start/end alternate character set. Not really 133 /* "as"/"ae" -- start/end alternate character set. Not really
134 supported, yet. */ 134 supported, yet. */
135 char *TS_enter_alt_charset_mode; 135 const char *TS_enter_alt_charset_mode;
136 char *TS_exit_alt_charset_mode; 136 const char *TS_exit_alt_charset_mode;
137 137
138 char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ 138 const char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */
139 139
140 /* Value of the "NC" (no_color_video) capability, or 0 if not present. */ 140 /* Value of the "NC" (no_color_video) capability, or 0 if not present. */
141 int TN_no_color_video; 141 int TN_no_color_video;
@@ -147,12 +147,12 @@ struct tty_display_info
147 int TN_max_pairs; 147 int TN_max_pairs;
148 148
149 /* "op" -- SVr4 set default pair to its original value. */ 149 /* "op" -- SVr4 set default pair to its original value. */
150 char *TS_orig_pair; 150 const char *TS_orig_pair;
151 151
152 /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color. 152 /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
153 1 param, the color index. */ 153 1 param, the color index. */
154 char *TS_set_foreground; 154 const char *TS_set_foreground;
155 char *TS_set_background; 155 const char *TS_set_background;
156 156
157 int TF_hazeltine; /* termcap hz flag. */ 157 int TF_hazeltine; /* termcap hz flag. */
158 int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */ 158 int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */
@@ -210,4 +210,3 @@ extern struct tty_display_info *tty_list;
210 : (abort(), (struct tty_display_info *) 0)) 210 : (abort(), (struct tty_display_info *) 0))
211 211
212#define CURTTY() FRAME_TTY (SELECTED_FRAME()) 212#define CURTTY() FRAME_TTY (SELECTED_FRAME())
213
diff --git a/src/terminal.c b/src/terminal.c
index 309cc0095e8..c5185601fb6 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -109,7 +109,7 @@ void
109raw_cursor_to (struct frame *f, int row, int col) 109raw_cursor_to (struct frame *f, int row, int col)
110{ 110{
111 if (FRAME_TERMINAL (f)->raw_cursor_to_hook) 111 if (FRAME_TERMINAL (f)->raw_cursor_to_hook)
112 (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); 112 (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col);
113} 113}
114 114
115/* Erase operations */ 115/* Erase operations */
@@ -444,7 +444,7 @@ selected frame's terminal). */)
444/* Set the value of terminal parameter PARAMETER in terminal D to VALUE. 444/* Set the value of terminal parameter PARAMETER in terminal D to VALUE.
445 Return the previous value. */ 445 Return the previous value. */
446 446
447Lisp_Object 447static Lisp_Object
448store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value) 448store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value)
449{ 449{
450 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); 450 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist);
@@ -569,4 +569,3 @@ or some time later. */);
569 569
570 Fprovide (intern_c_string ("multi-tty"), Qnil); 570 Fprovide (intern_c_string ("multi-tty"), Qnil);
571} 571}
572
diff --git a/src/tparam.c b/src/tparam.c
index fcbb63881e6..6aae0b97db9 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */
21#include <config.h> 21#include <config.h>
22#include <setjmp.h> 22#include <setjmp.h>
23#include "lisp.h" /* for xmalloc */ 23#include "lisp.h" /* for xmalloc */
24#include "tparam.h"
24 25
25#ifndef NULL 26#ifndef NULL
26#define NULL (char *) 0 27#define NULL (char *) 0
@@ -38,11 +39,12 @@ Boston, MA 02110-1301, USA. */
38 39
39 The fourth and following args to tparam serve as the parameter values. */ 40 The fourth and following args to tparam serve as the parameter values. */
40 41
41static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); 42static char *tparam1 (char const *string, char *outstring, int len,
43 char *up, char *left, int *argp);
42 44
43/* VARARGS 2 */
44char * 45char *
45tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) 46tparam (const char *string, char *outstring, int len,
47 int arg0, int arg1, int arg2, int arg3)
46{ 48{
47 int arg[4]; 49 int arg[4];
48 50
@@ -59,7 +61,7 @@ char *UP;
59static char tgoto_buf[50]; 61static char tgoto_buf[50];
60 62
61char * 63char *
62tgoto (char *cm, int hpos, int vpos) 64tgoto (const char *cm, int hpos, int vpos)
63{ 65{
64 int args[2]; 66 int args[2];
65 if (!cm) 67 if (!cm)
@@ -70,10 +72,11 @@ tgoto (char *cm, int hpos, int vpos)
70} 72}
71 73
72static char * 74static char *
73tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) 75tparam1 (const char *string, char *outstring, int len,
76 char *up, char *left, register int *argp)
74{ 77{
75 register int c; 78 register int c;
76 register char *p = string; 79 register const char *p = string;
77 register char *op = outstring; 80 register char *op = outstring;
78 char *outend; 81 char *outend;
79 int outlen = 0; 82 int outlen = 0;
@@ -277,4 +280,3 @@ main (argc, argv)
277} 280}
278 281
279#endif /* DEBUG */ 282#endif /* DEBUG */
280
diff --git a/src/tparam.h b/src/tparam.h
new file mode 100644
index 00000000000..3cd3e6053cc
--- /dev/null
+++ b/src/tparam.h
@@ -0,0 +1,31 @@
1/* Interface definitions for termcap entries.
2
3Copyright (C) 2011 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20
21/* Don't try to include termcap.h. On some systems, configure finds a
22 non-standard termcap.h that the main build won't find. */
23
24void tputs (const char *, int, int (*) (int));
25int tgetent (char *, const char *);
26int tgetflag (const char *);
27int tgetnum (const char *);
28char *tgetstr (const char *, char **);
29char *tgoto (const char *, int, int);
30
31char *tparam (const char *, char *, int, int, int, int, int);
diff --git a/src/window.c b/src/window.c
index 7c55be972b2..eaa910571e0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2209,13 +2209,13 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2209 case DELETE_BUFFER_WINDOWS: 2209 case DELETE_BUFFER_WINDOWS:
2210 if (EQ (w->buffer, obj)) 2210 if (EQ (w->buffer, obj))
2211 { 2211 {
2212 struct frame *f = XFRAME (WINDOW_FRAME (w)); 2212 struct frame *fr = XFRAME (WINDOW_FRAME (w));
2213 2213
2214 /* If this window is dedicated, and in a frame of its own, 2214 /* If this window is dedicated, and in a frame of its own,
2215 kill the frame. */ 2215 kill the frame. */
2216 if (EQ (window, FRAME_ROOT_WINDOW (f)) 2216 if (EQ (window, FRAME_ROOT_WINDOW (fr))
2217 && !NILP (w->dedicated) 2217 && !NILP (w->dedicated)
2218 && other_visible_frames (f)) 2218 && other_visible_frames (fr))
2219 { 2219 {
2220 /* Skip the other windows on this frame. 2220 /* Skip the other windows on this frame.
2221 There might be one, the minibuffer! */ 2221 There might be one, the minibuffer! */
@@ -2267,16 +2267,16 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2267 if (EQ (w->buffer, obj)) 2267 if (EQ (w->buffer, obj))
2268 { 2268 {
2269 Lisp_Object buffer; 2269 Lisp_Object buffer;
2270 struct frame *f = XFRAME (w->frame); 2270 struct frame *fr = XFRAME (w->frame);
2271 2271
2272 /* Find another buffer to show in this window. */ 2272 /* Find another buffer to show in this window. */
2273 buffer = Fother_buffer (obj, Qnil, w->frame); 2273 buffer = Fother_buffer (obj, Qnil, w->frame);
2274 2274
2275 /* If this window is dedicated, and in a frame of its own, 2275 /* If this window is dedicated, and in a frame of its own,
2276 kill the frame. */ 2276 kill the frame. */
2277 if (EQ (window, FRAME_ROOT_WINDOW (f)) 2277 if (EQ (window, FRAME_ROOT_WINDOW (fr))
2278 && !NILP (w->dedicated) 2278 && !NILP (w->dedicated)
2279 && other_visible_frames (f)) 2279 && other_visible_frames (fr))
2280 { 2280 {
2281 /* Skip the other windows on this frame. 2281 /* Skip the other windows on this frame.
2282 There might be one, the minibuffer! */ 2282 There might be one, the minibuffer! */
@@ -2290,11 +2290,11 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2290 } 2290 }
2291 else if (!NILP (w->dedicated) && !NILP (w->parent)) 2291 else if (!NILP (w->dedicated) && !NILP (w->parent))
2292 { 2292 {
2293 Lisp_Object window; 2293 Lisp_Object window_to_delete;
2294 XSETWINDOW (window, w); 2294 XSETWINDOW (window_to_delete, w);
2295 /* If this window is dedicated and not the only window 2295 /* If this window is dedicated and not the only window
2296 in its frame, then kill it. */ 2296 in its frame, then kill it. */
2297 Fdelete_window (window); 2297 Fdelete_window (window_to_delete);
2298 } 2298 }
2299 else 2299 else
2300 { 2300 {
@@ -3124,7 +3124,7 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3124 } 3124 }
3125 else if (!NILP (*forward)) 3125 else if (!NILP (*forward))
3126 { 3126 {
3127 int fixed_size, each, extra, n; 3127 int fixed_size, each IF_LINT (= 0), extra IF_LINT (= 0), n;
3128 int resize_fixed_p, nfixed; 3128 int resize_fixed_p, nfixed;
3129 int last_pos, first_pos, nchildren, total; 3129 int last_pos, first_pos, nchildren, total;
3130 int *new_sizes = NULL; 3130 int *new_sizes = NULL;
@@ -3170,11 +3170,11 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3170 last_pos = first_pos; 3170 last_pos = first_pos;
3171 for (n = 0, child = *forward; !NILP (child); child = c->next, ++n) 3171 for (n = 0, child = *forward; !NILP (child); child = c->next, ++n)
3172 { 3172 {
3173 int new_size, old_size; 3173 int new_child_size, old_child_size;
3174 3174
3175 c = XWINDOW (child); 3175 c = XWINDOW (child);
3176 old_size = WINDOW_TOTAL_SIZE (c, width_p); 3176 old_child_size = WINDOW_TOTAL_SIZE (c, width_p);
3177 new_size = old_size; 3177 new_child_size = old_child_size;
3178 3178
3179 /* The top or left edge position of this child equals the 3179 /* The top or left edge position of this child equals the
3180 bottom or right edge of its predecessor. */ 3180 bottom or right edge of its predecessor. */
@@ -3186,18 +3186,20 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3186 /* If this child can be resized, do it. */ 3186 /* If this child can be resized, do it. */
3187 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) 3187 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0))
3188 { 3188 {
3189 new_size = new_sizes ? new_sizes[n] : old_size + each + extra; 3189 new_child_size =
3190 new_sizes ? new_sizes[n] : old_child_size + each + extra;
3190 extra = 0; 3191 extra = 0;
3191 } 3192 }
3192 3193
3193 /* Set new size. Note that size_window also propagates 3194 /* Set new size. Note that size_window also propagates
3194 edge positions to children, so it's not a no-op if we 3195 edge positions to children, so it's not a no-op if we
3195 didn't change the child's size. */ 3196 didn't change the child's size. */
3196 size_window (child, new_size, width_p, 1, first_only, last_only); 3197 size_window (child, new_child_size, width_p, 1,
3198 first_only, last_only);
3197 3199
3198 /* Remember the bottom/right edge position of this child; it 3200 /* Remember the bottom/right edge position of this child; it
3199 will be used to set the top/left edge of the next child. */ 3201 will be used to set the top/left edge of the next child. */
3200 last_pos += new_size; 3202 last_pos += new_child_size;
3201 } 3203 }
3202 3204
3203 xfree (new_sizes); 3205 xfree (new_sizes);
@@ -3325,12 +3327,12 @@ run_window_configuration_change_hook (struct frame *f)
3325 if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, 3327 if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook,
3326 buffer))) 3328 buffer)))
3327 { 3329 {
3328 int count = SPECPDL_INDEX (); 3330 int count1 = SPECPDL_INDEX ();
3329 record_unwind_protect (select_window_norecord, Fselected_window ()); 3331 record_unwind_protect (select_window_norecord, Fselected_window ());
3330 select_window_norecord (window); 3332 select_window_norecord (window);
3331 run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, 3333 run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook,
3332 buffer)); 3334 buffer));
3333 unbind_to (count, Qnil); 3335 unbind_to (count1, Qnil);
3334 } 3336 }
3335 } 3337 }
3336 } 3338 }
@@ -3602,7 +3604,7 @@ select_frame_norecord (Lisp_Object frame)
3602 ? Fselect_frame (frame, Qt) : selected_frame; 3604 ? Fselect_frame (frame, Qt) : selected_frame;
3603} 3605}
3604 3606
3605Lisp_Object 3607static Lisp_Object
3606display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame) 3608display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame)
3607{ 3609{
3608 return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame); 3610 return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame);
@@ -4119,7 +4121,7 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag)
4119 { 4121 {
4120 /* If trying to grow this window to or beyond size of the parent, 4122 /* If trying to grow this window to or beyond size of the parent,
4121 just delete all the sibling windows. */ 4123 just delete all the sibling windows. */
4122 Lisp_Object start, tem, next; 4124 Lisp_Object start, tem;
4123 4125
4124 start = XWINDOW (parent)->vchild; 4126 start = XWINDOW (parent)->vchild;
4125 if (NILP (start)) 4127 if (NILP (start))
@@ -4129,9 +4131,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag)
4129 tem = XWINDOW (window)->next; 4131 tem = XWINDOW (window)->next;
4130 while (! NILP (tem)) 4132 while (! NILP (tem))
4131 { 4133 {
4132 next = XWINDOW (tem)->next; 4134 Lisp_Object next1 = XWINDOW (tem)->next;
4133 delete_window (tem); 4135 delete_window (tem);
4134 tem = next; 4136 tem = next1;
4135 } 4137 }
4136 4138
4137 /* Delete any siblings that come after WINDOW. 4139 /* Delete any siblings that come after WINDOW.
@@ -4140,9 +4142,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag)
4140 tem = start; 4142 tem = start;
4141 while (! EQ (tem, window)) 4143 while (! EQ (tem, window))
4142 { 4144 {
4143 next = XWINDOW (tem)->next; 4145 Lisp_Object next1 = XWINDOW (tem)->next;
4144 delete_window (tem); 4146 delete_window (tem);
4145 tem = next; 4147 tem = next1;
4146 } 4148 }
4147 } 4149 }
4148 else 4150 else
@@ -5520,7 +5522,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5520 struct buffer *obuf = current_buffer; 5522 struct buffer *obuf = current_buffer;
5521 int center_p = 0; 5523 int center_p = 0;
5522 EMACS_INT charpos, bytepos; 5524 EMACS_INT charpos, bytepos;
5523 int iarg; 5525 int iarg IF_LINT (= 0);
5524 int this_scroll_margin; 5526 int this_scroll_margin;
5525 5527
5526 /* If redisplay is suppressed due to an error, try again. */ 5528 /* If redisplay is suppressed due to an error, try again. */
@@ -7224,4 +7226,3 @@ keys_of_window (void)
7224 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); 7226 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
7225 initial_define_key (meta_map, 'v', "scroll-down-command"); 7227 initial_define_key (meta_map, 'v', "scroll-down-command");
7226} 7228}
7227
diff --git a/src/window.h b/src/window.h
index 690fd9a50fa..f788e126d6d 100644
--- a/src/window.h
+++ b/src/window.h
@@ -778,6 +778,7 @@ extern void freeze_window_starts (struct frame *, int);
778extern void grow_mini_window (struct window *, int); 778extern void grow_mini_window (struct window *, int);
779extern void shrink_mini_window (struct window *); 779extern void shrink_mini_window (struct window *);
780extern int window_relative_x_coord (struct window *, enum window_part, int); 780extern int window_relative_x_coord (struct window *, enum window_part, int);
781extern void check_all_windows (void);
781 782
782void run_window_configuration_change_hook (struct frame *f); 783void run_window_configuration_change_hook (struct frame *f);
783 784
diff --git a/src/xdisp.c b/src/xdisp.c
index e62b491ad32..f2477a2eca5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -14163,11 +14163,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14163 { 14163 {
14164 /* The function returns -1 if new fonts were loaded, 1 if 14164 /* The function returns -1 if new fonts were loaded, 1 if
14165 successful, 0 if not successful. */ 14165 successful, 0 if not successful. */
14166 int rc = try_scrolling (window, just_this_one_p, 14166 int ss = try_scrolling (window, just_this_one_p,
14167 scroll_conservatively, 14167 scroll_conservatively,
14168 emacs_scroll_step, 14168 emacs_scroll_step,
14169 temp_scroll_step, last_line_misfit); 14169 temp_scroll_step, last_line_misfit);
14170 switch (rc) 14170 switch (ss)
14171 { 14171 {
14172 case SCROLLING_SUCCESS: 14172 case SCROLLING_SUCCESS:
14173 goto done; 14173 goto done;
@@ -17229,14 +17229,16 @@ display_line (struct it *it)
17229 struct glyph_row *row = it->glyph_row; 17229 struct glyph_row *row = it->glyph_row;
17230 Lisp_Object overlay_arrow_string; 17230 Lisp_Object overlay_arrow_string;
17231 struct it wrap_it; 17231 struct it wrap_it;
17232 int may_wrap = 0, wrap_x; 17232 int may_wrap = 0, wrap_x IF_LINT (= 0);
17233 int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; 17233 int wrap_row_used = -1;
17234 int wrap_row_phys_ascent, wrap_row_phys_height; 17234 int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0);
17235 int wrap_row_extra_line_spacing; 17235 int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0);
17236 EMACS_INT wrap_row_min_pos, wrap_row_min_bpos; 17236 int wrap_row_extra_line_spacing IF_LINT (= 0);
17237 EMACS_INT wrap_row_max_pos, wrap_row_max_bpos; 17237 EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0);
17238 EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0);
17238 int cvpos; 17239 int cvpos;
17239 EMACS_INT min_pos = ZV + 1, min_bpos, max_pos = 0, max_bpos; 17240 EMACS_INT min_pos = ZV + 1, max_pos = 0;
17241 EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0);
17240 17242
17241 /* We always start displaying at hpos zero even if hscrolled. */ 17243 /* We always start displaying at hpos zero even if hscrolled. */
17242 xassert (it->hpos == 0 && it->current_x == 0); 17244 xassert (it->hpos == 0 && it->current_x == 0);
@@ -17910,16 +17912,13 @@ paragraphs, text begins at the right margin and is read from right to left.
17910See also `bidi-paragraph-direction'. */) 17912See also `bidi-paragraph-direction'. */)
17911 (Lisp_Object buffer) 17913 (Lisp_Object buffer)
17912{ 17914{
17913 struct buffer *buf; 17915 struct buffer *buf = current_buffer;
17914 struct buffer *old; 17916 struct buffer *old = buf;
17915 17917
17916 if (NILP (buffer)) 17918 if (! NILP (buffer))
17917 buf = current_buffer;
17918 else
17919 { 17919 {
17920 CHECK_BUFFER (buffer); 17920 CHECK_BUFFER (buffer);
17921 buf = XBUFFER (buffer); 17921 buf = XBUFFER (buffer);
17922 old = current_buffer;
17923 } 17922 }
17924 17923
17925 if (NILP (BVAR (buf, bidi_display_reordering))) 17924 if (NILP (BVAR (buf, bidi_display_reordering)))
@@ -17936,8 +17935,7 @@ See also `bidi-paragraph-direction'. */)
17936 EMACS_INT bytepos = BUF_PT_BYTE (buf); 17935 EMACS_INT bytepos = BUF_PT_BYTE (buf);
17937 int c; 17936 int c;
17938 17937
17939 if (buf != current_buffer) 17938 set_buffer_temp (buf);
17940 set_buffer_temp (buf);
17941 /* bidi_paragraph_init finds the base direction of the paragraph 17939 /* bidi_paragraph_init finds the base direction of the paragraph
17942 by searching forward from paragraph start. We need the base 17940 by searching forward from paragraph start. We need the base
17943 direction of the current or _previous_ paragraph, so we need 17941 direction of the current or _previous_ paragraph, so we need
@@ -17965,8 +17963,7 @@ See also `bidi-paragraph-direction'. */)
17965 itb.paragraph_dir = NEUTRAL_DIR; 17963 itb.paragraph_dir = NEUTRAL_DIR;
17966 17964
17967 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); 17965 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1);
17968 if (buf != current_buffer) 17966 set_buffer_temp (old);
17969 set_buffer_temp (old);
17970 switch (itb.paragraph_dir) 17967 switch (itb.paragraph_dir)
17971 { 17968 {
17972 case L2R: 17969 case L2R:
@@ -21090,7 +21087,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
21090 int cmp_id = (row)->glyphs[area][START].u.cmp.id; \ 21087 int cmp_id = (row)->glyphs[area][START].u.cmp.id; \
21091 struct composition *cmp = composition_table[cmp_id]; \ 21088 struct composition *cmp = composition_table[cmp_id]; \
21092 XChar2b *char2b; \ 21089 XChar2b *char2b; \
21093 struct glyph_string *first_s; \ 21090 struct glyph_string *first_s IF_LINT (= NULL); \
21094 int n; \ 21091 int n; \
21095 \ 21092 \
21096 char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ 21093 char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \
@@ -21294,7 +21291,8 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
21294 { 21291 {
21295 struct glyph_string *h, *t; 21292 struct glyph_string *h, *t;
21296 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 21293 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
21297 int mouse_beg_col, mouse_end_col, check_mouse_face = 0; 21294 int mouse_beg_col IF_LINT (= 0), mouse_end_col IF_LINT (= 0);
21295 int check_mouse_face = 0;
21298 int dummy_x = 0; 21296 int dummy_x = 0;
21299 21297
21300 /* If mouse highlighting is on, we may need to draw adjacent 21298 /* If mouse highlighting is on, we may need to draw adjacent
@@ -22290,7 +22288,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
22290 if (metrics_upper.width >= metrics_lower.width) 22288 if (metrics_upper.width >= metrics_lower.width)
22291 lower_xoff = (width - metrics_lower.width) / 2; 22289 lower_xoff = (width - metrics_lower.width) / 2;
22292 else 22290 else
22293 upper_xoff = (width - metrics_upper.width) / 2; 22291 {
22292 /* FIXME: This code doesn't look right. It formerly was
22293 missing the "lower_xoff = 0;", which couldn't have
22294 been right since it left lower_xoff uninitialized. */
22295 lower_xoff = 0;
22296 upper_xoff = (width - metrics_upper.width) / 2;
22297 }
22294 } 22298 }
22295 22299
22296 /* +5 is for horizontal bars of a box plus 1-pixel spaces at 22300 /* +5 is for horizontal bars of a box plus 1-pixel spaces at
@@ -25451,7 +25455,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
25451 { 25455 {
25452 /* The mouse-highlighting, if any, comes from an overlay 25456 /* The mouse-highlighting, if any, comes from an overlay
25453 or text property in the buffer. */ 25457 or text property in the buffer. */
25454 Lisp_Object buffer, cover_string; 25458 Lisp_Object buffer IF_LINT (= Qnil);
25459 Lisp_Object cover_string IF_LINT (= Qnil);
25455 25460
25456 if (STRINGP (object)) 25461 if (STRINGP (object))
25457 { 25462 {
diff --git a/src/xfaces.c b/src/xfaces.c
index 4cc47c85050..50bcab3c6a9 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -297,16 +297,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
297 297
298#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) 298#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
299 299
300/* Make a copy of string S on the stack using alloca. Value is a pointer
301 to the copy. */
302
303#define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S))
304
305/* Make a copy of the contents of Lisp string S on the stack using
306 alloca. Value is a pointer to the copy. */
307
308#define LSTRDUPA(S) STRDUPA (SDATA ((S)))
309
310/* Size of hash table of realized faces in face caches (should be a 300/* Size of hash table of realized faces in face caches (should be a
311 prime number). */ 301 prime number). */
312 302
@@ -847,7 +837,6 @@ clear_face_cache (int clear_fonts_p)
847{ 837{
848#ifdef HAVE_WINDOW_SYSTEM 838#ifdef HAVE_WINDOW_SYSTEM
849 Lisp_Object tail, frame; 839 Lisp_Object tail, frame;
850 struct frame *f;
851 840
852 if (clear_fonts_p 841 if (clear_fonts_p
853 || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT) 842 || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT)
@@ -875,7 +864,7 @@ clear_face_cache (int clear_fonts_p)
875 /* Clear GCs of realized faces. */ 864 /* Clear GCs of realized faces. */
876 FOR_EACH_FRAME (tail, frame) 865 FOR_EACH_FRAME (tail, frame)
877 { 866 {
878 f = XFRAME (frame); 867 struct frame *f = XFRAME (frame);
879 if (FRAME_WINDOW_P (f)) 868 if (FRAME_WINDOW_P (f))
880 clear_face_gcs (FRAME_FACE_CACHE (f)); 869 clear_face_gcs (FRAME_FACE_CACHE (f));
881 } 870 }
@@ -1113,7 +1102,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor
1113 1102
1114/* A version of defined_color for non-X frames. */ 1103/* A version of defined_color for non-X frames. */
1115 1104
1116int 1105static int
1117tty_defined_color (struct frame *f, const char *color_name, 1106tty_defined_color (struct frame *f, const char *color_name,
1118 XColor *color_def, int alloc) 1107 XColor *color_def, int alloc)
1119{ 1108{
@@ -1721,7 +1710,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1721 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) 1710 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width)
1722{ 1711{
1723 struct frame *f; 1712 struct frame *f;
1724 int size, avgwidth; 1713 int size, avgwidth IF_LINT (= 0);
1725 1714
1726 check_x (); 1715 check_x ();
1727 CHECK_STRING (pattern); 1716 CHECK_STRING (pattern);
@@ -1754,14 +1743,14 @@ the WIDTH times as wide as FACE on FRAME. */)
1754 /* This is of limited utility since it works with character 1743 /* This is of limited utility since it works with character
1755 widths. Keep it for compatibility. --gerd. */ 1744 widths. Keep it for compatibility. --gerd. */
1756 int face_id = lookup_named_face (f, face, 0); 1745 int face_id = lookup_named_face (f, face, 0);
1757 struct face *face = (face_id < 0 1746 struct face *width_face = (face_id < 0
1758 ? NULL 1747 ? NULL
1759 : FACE_FROM_ID (f, face_id)); 1748 : FACE_FROM_ID (f, face_id));
1760 1749
1761 if (face && face->font) 1750 if (width_face && width_face->font)
1762 { 1751 {
1763 size = face->font->pixel_size; 1752 size = width_face->font->pixel_size;
1764 avgwidth = face->font->average_width; 1753 avgwidth = width_face->font->average_width;
1765 } 1754 }
1766 else 1755 else
1767 { 1756 {
@@ -1838,6 +1827,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1838#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) 1827#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX)
1839#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) 1828#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX)
1840 1829
1830#if XASSERTS
1841/* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size 1831/* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size
1842 LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ 1832 LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */
1843 1833
@@ -1845,6 +1835,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1845 (VECTORP (LFACE) \ 1835 (VECTORP (LFACE) \
1846 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ 1836 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \
1847 && EQ (AREF (LFACE, 0), Qface)) 1837 && EQ (AREF (LFACE, 0), Qface))
1838#endif
1848 1839
1849 1840
1850#if GLYPH_DEBUG 1841#if GLYPH_DEBUG
@@ -2252,7 +2243,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object
2252 `relative' heights; the returned value is always an absolute height 2243 `relative' heights; the returned value is always an absolute height
2253 unless both FROM and TO are relative. */ 2244 unless both FROM and TO are relative. */
2254 2245
2255Lisp_Object 2246static Lisp_Object
2256merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) 2247merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2257{ 2248{
2258 Lisp_Object result = invalid; 2249 Lisp_Object result = invalid;
@@ -3869,19 +3860,19 @@ return the font name used for CHARACTER. */)
3869 { 3860 {
3870 struct frame *f = frame_or_selected_frame (frame, 1); 3861 struct frame *f = frame_or_selected_frame (frame, 1);
3871 int face_id = lookup_named_face (f, face, 1); 3862 int face_id = lookup_named_face (f, face, 1);
3872 struct face *face = FACE_FROM_ID (f, face_id); 3863 struct face *fface = FACE_FROM_ID (f, face_id);
3873 3864
3874 if (! face) 3865 if (! fface)
3875 return Qnil; 3866 return Qnil;
3876#ifdef HAVE_WINDOW_SYSTEM 3867#ifdef HAVE_WINDOW_SYSTEM
3877 if (FRAME_WINDOW_P (f) && !NILP (character)) 3868 if (FRAME_WINDOW_P (f) && !NILP (character))
3878 { 3869 {
3879 CHECK_CHARACTER (character); 3870 CHECK_CHARACTER (character);
3880 face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); 3871 face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil);
3881 face = FACE_FROM_ID (f, face_id); 3872 fface = FACE_FROM_ID (f, face_id);
3882 } 3873 }
3883 return (face->font 3874 return (fface->font
3884 ? face->font->props[FONT_NAME_INDEX] 3875 ? fface->font->props[FONT_NAME_INDEX]
3885 : Qnil); 3876 : Qnil);
3886#else /* !HAVE_WINDOW_SYSTEM */ 3877#else /* !HAVE_WINDOW_SYSTEM */
3887 return build_string (FRAME_MSDOS_P (f) 3878 return build_string (FRAME_MSDOS_P (f)
@@ -4313,45 +4304,6 @@ free_realized_faces (struct face_cache *c)
4313} 4304}
4314 4305
4315 4306
4316/* Free all realized faces that are using FONTSET on frame F. */
4317
4318void
4319free_realized_faces_for_fontset (struct frame *f, int fontset)
4320{
4321 struct face_cache *cache = FRAME_FACE_CACHE (f);
4322 struct face *face;
4323 int i;
4324
4325 /* We must block input here because we can't process X events safely
4326 while only some faces are freed, or when the frame's current
4327 matrix still references freed faces. */
4328 BLOCK_INPUT;
4329
4330 for (i = 0; i < cache->used; i++)
4331 {
4332 face = cache->faces_by_id[i];
4333 if (face
4334 && face->fontset == fontset)
4335 {
4336 uncache_face (cache, face);
4337 free_realized_face (f, face);
4338 }
4339 }
4340
4341 /* Must do a thorough redisplay the next time. Mark current
4342 matrices as invalid because they will reference faces freed
4343 above. This function is also called when a frame is destroyed.
4344 In this case, the root window of F is nil. */
4345 if (WINDOWP (f->root_window))
4346 {
4347 clear_current_matrices (f);
4348 ++windows_or_buffers_changed;
4349 }
4350
4351 UNBLOCK_INPUT;
4352}
4353
4354
4355/* Free all realized faces on FRAME or on all frames if FRAME is nil. 4307/* Free all realized faces on FRAME or on all frames if FRAME is nil.
4356 This is done after attributes of a named face have been changed, 4308 This is done after attributes of a named face have been changed,
4357 because we can't tell which realized faces depend on that face. */ 4309 because we can't tell which realized faces depend on that face. */
@@ -5287,10 +5239,6 @@ be found. Value is ALIST. */)
5287 5239
5288#ifdef HAVE_WINDOW_SYSTEM 5240#ifdef HAVE_WINDOW_SYSTEM
5289 5241
5290/* Ignore the difference of font point size less than this value. */
5291
5292#define FONT_POINT_SIZE_QUANTUM 5
5293
5294/* Return the fontset id of the base fontset name or alias name given 5242/* Return the fontset id of the base fontset name or alias name given
5295 by the fontset attribute of ATTRS. Value is -1 if the fontset 5243 by the fontset attribute of ATTRS. Value is -1 if the fontset
5296 attribute of ATTRS doesn't name a fontset. */ 5244 attribute of ATTRS doesn't name a fontset. */
diff --git a/src/xfns.c b/src/xfns.c
index deb0e192a54..3f0bd2a7d6a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -461,7 +461,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
461 Window win = f->output_data.x->parent_desc; 461 Window win = f->output_data.x->parent_desc;
462 Atom actual_type; 462 Atom actual_type;
463 unsigned long actual_size, bytes_remaining; 463 unsigned long actual_size, bytes_remaining;
464 int i, rc, actual_format; 464 int rc, actual_format;
465 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 465 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
466 long max_len = 400; 466 long max_len = 400;
467 Display *dpy = FRAME_X_DISPLAY (f); 467 Display *dpy = FRAME_X_DISPLAY (f);
@@ -648,7 +648,7 @@ x_defined_color (struct frame *f, const char *color_name,
648 is a monochrome frame, return MONO_COLOR regardless of what ARG says. 648 is a monochrome frame, return MONO_COLOR regardless of what ARG says.
649 Signal an error if color can't be allocated. */ 649 Signal an error if color can't be allocated. */
650 650
651int 651static int
652x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) 652x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color)
653{ 653{
654 XColor cdef; 654 XColor cdef;
@@ -746,7 +746,6 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
746int 746int
747xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) 747xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data)
748{ 748{
749 int result = 0;
750 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); 749 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
751 750
752 if (!pixbuf) 751 if (!pixbuf)
@@ -1635,7 +1634,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1635 suggesting a new name, which lisp code should override; if 1634 suggesting a new name, which lisp code should override; if
1636 F->explicit_name is set, ignore the new name; otherwise, set it. */ 1635 F->explicit_name is set, ignore the new name; otherwise, set it. */
1637 1636
1638void 1637static void
1639x_set_name (struct frame *f, Lisp_Object name, int explicit) 1638x_set_name (struct frame *f, Lisp_Object name, int explicit)
1640{ 1639{
1641 /* Make sure that requests from lisp code override requests from 1640 /* Make sure that requests from lisp code override requests from
@@ -2620,7 +2619,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2620 2619
2621#else /* not USE_X_TOOLKIT */ 2620#else /* not USE_X_TOOLKIT */
2622#ifdef USE_GTK 2621#ifdef USE_GTK
2623void 2622static void
2624x_window (FRAME_PTR f) 2623x_window (FRAME_PTR f)
2625{ 2624{
2626 if (! xg_create_frame_widgets (f)) 2625 if (! xg_create_frame_widgets (f))
@@ -2660,7 +2659,7 @@ x_window (FRAME_PTR f)
2660#else /*! USE_GTK */ 2659#else /*! USE_GTK */
2661/* Create and set up the X window for frame F. */ 2660/* Create and set up the X window for frame F. */
2662 2661
2663void 2662static void
2664x_window (struct frame *f) 2663x_window (struct frame *f)
2665{ 2664{
2666 XClassHint class_hints; 2665 XClassHint class_hints;
@@ -3184,7 +3183,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3184 to get the color reference counts right, so initialize them! */ 3183 to get the color reference counts right, so initialize them! */
3185 { 3184 {
3186 Lisp_Object black; 3185 Lisp_Object black;
3187 struct gcpro gcpro1; 3186 struct gcpro inner_gcpro1;
3188 3187
3189 /* Function x_decode_color can signal an error. Make 3188 /* Function x_decode_color can signal an error. Make
3190 sure to initialize color slots so that we won't try 3189 sure to initialize color slots so that we won't try
@@ -3197,7 +3196,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3197 f->output_data.x->mouse_pixel = -1; 3196 f->output_data.x->mouse_pixel = -1;
3198 3197
3199 black = build_string ("black"); 3198 black = build_string ("black");
3200 GCPRO1 (black); 3199 GCPRO1_VAR (black, inner_gcpro1);
3201 FRAME_FOREGROUND_PIXEL (f) 3200 FRAME_FOREGROUND_PIXEL (f)
3202 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 3201 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
3203 FRAME_BACKGROUND_PIXEL (f) 3202 FRAME_BACKGROUND_PIXEL (f)
@@ -3210,7 +3209,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3210 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 3209 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
3211 f->output_data.x->mouse_pixel 3210 f->output_data.x->mouse_pixel
3212 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 3211 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
3213 UNGCPRO; 3212 UNGCPRO_VAR (inner_gcpro1);
3214 } 3213 }
3215 3214
3216 /* Specify the parent under which to make this X window. */ 3215 /* Specify the parent under which to make this X window. */
@@ -3448,8 +3447,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3448 else if (! NILP (visibility)) 3447 else if (! NILP (visibility))
3449 x_make_frame_visible (f); 3448 x_make_frame_visible (f);
3450 else 3449 else
3451 /* Must have been Qnil. */ 3450 {
3452 ; 3451 /* Must have been Qnil. */
3452 }
3453 } 3453 }
3454 3454
3455 BLOCK_INPUT; 3455 BLOCK_INPUT;
@@ -4577,7 +4577,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4577 Lisp_Object text) 4577 Lisp_Object text)
4578{ 4578{
4579 struct frame *f; 4579 struct frame *f;
4580 Lisp_Object frame, tem; 4580 Lisp_Object frame;
4581 Lisp_Object name; 4581 Lisp_Object name;
4582 long window_prompting = 0; 4582 long window_prompting = 0;
4583 int width, height; 4583 int width, height;
@@ -4651,7 +4651,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4651 to get the color reference counts right, so initialize them! */ 4651 to get the color reference counts right, so initialize them! */
4652 { 4652 {
4653 Lisp_Object black; 4653 Lisp_Object black;
4654 struct gcpro gcpro1; 4654 struct gcpro inner_gcpro1;
4655 4655
4656 /* Function x_decode_color can signal an error. Make 4656 /* Function x_decode_color can signal an error. Make
4657 sure to initialize color slots so that we won't try 4657 sure to initialize color slots so that we won't try
@@ -4664,7 +4664,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4664 f->output_data.x->mouse_pixel = -1; 4664 f->output_data.x->mouse_pixel = -1;
4665 4665
4666 black = build_string ("black"); 4666 black = build_string ("black");
4667 GCPRO1 (black); 4667 GCPRO1_VAR (black, inner_gcpro1);
4668 FRAME_FOREGROUND_PIXEL (f) 4668 FRAME_FOREGROUND_PIXEL (f)
4669 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 4669 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
4670 FRAME_BACKGROUND_PIXEL (f) 4670 FRAME_BACKGROUND_PIXEL (f)
@@ -4677,7 +4677,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4677 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 4677 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
4678 f->output_data.x->mouse_pixel 4678 f->output_data.x->mouse_pixel
4679 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 4679 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
4680 UNGCPRO; 4680 UNGCPRO_VAR (inner_gcpro1);
4681 } 4681 }
4682 4682
4683 /* Set the name; the functions to which we pass f expect the name to 4683 /* Set the name; the functions to which we pass f expect the name to
@@ -5035,7 +5035,7 @@ Text larger than the specified size is clipped. */)
5035 && !NILP (Fequal (last_string, string)) 5035 && !NILP (Fequal (last_string, string))
5036 && !NILP (Fequal (last_parms, parms))) 5036 && !NILP (Fequal (last_parms, parms)))
5037 { 5037 {
5038 struct frame *f = XFRAME (tip_frame); 5038 struct frame *tip_f = XFRAME (tip_frame);
5039 5039
5040 /* Only DX and DY have changed. */ 5040 /* Only DX and DY have changed. */
5041 if (!NILP (tip_timer)) 5041 if (!NILP (tip_timer))
@@ -5046,9 +5046,9 @@ Text larger than the specified size is clipped. */)
5046 } 5046 }
5047 5047
5048 BLOCK_INPUT; 5048 BLOCK_INPUT;
5049 compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), 5049 compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f),
5050 FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); 5050 FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y);
5051 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5051 XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f),
5052 root_x, root_y); 5052 root_x, root_y);
5053 UNBLOCK_INPUT; 5053 UNBLOCK_INPUT;
5054 goto start_timer; 5054 goto start_timer;
@@ -5565,11 +5565,11 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5565 BLOCK_INPUT; 5565 BLOCK_INPUT;
5566 5566
5567 if (STRINGP (default_filename)) 5567 if (STRINGP (default_filename))
5568 cdef_file = SDATA (default_filename); 5568 cdef_file = SSDATA (default_filename);
5569 else 5569 else
5570 cdef_file = SDATA (dir); 5570 cdef_file = SSDATA (dir);
5571 5571
5572 fn = xg_get_file_name (f, SDATA (prompt), cdef_file, 5572 fn = xg_get_file_name (f, SSDATA (prompt), cdef_file,
5573 ! NILP (mustmatch), 5573 ! NILP (mustmatch),
5574 ! NILP (only_dir_p)); 5574 ! NILP (only_dir_p));
5575 5575
@@ -5625,12 +5625,12 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
5625 XSETFONT (font, FRAME_FONT (f)); 5625 XSETFONT (font, FRAME_FONT (f));
5626 font_param = Ffont_get (font, intern (":name")); 5626 font_param = Ffont_get (font, intern (":name"));
5627 if (STRINGP (font_param)) 5627 if (STRINGP (font_param))
5628 default_name = xstrdup (SDATA (font_param)); 5628 default_name = xstrdup (SSDATA (font_param));
5629 else 5629 else
5630 { 5630 {
5631 font_param = Fframe_parameter (frame, Qfont_param); 5631 font_param = Fframe_parameter (frame, Qfont_param);
5632 if (STRINGP (font_param)) 5632 if (STRINGP (font_param))
5633 default_name = xstrdup (SDATA (font_param)); 5633 default_name = xstrdup (SSDATA (font_param));
5634 } 5634 }
5635 5635
5636 if (default_name == NULL && x_last_font_name != NULL) 5636 if (default_name == NULL && x_last_font_name != NULL)
@@ -5694,7 +5694,7 @@ present and mapped to the usual X keysyms. */)
5694 struct frame *f = check_x_frame (frame); 5694 struct frame *f = check_x_frame (frame);
5695 Display *dpy = FRAME_X_DISPLAY (f); 5695 Display *dpy = FRAME_X_DISPLAY (f);
5696 Lisp_Object have_keys; 5696 Lisp_Object have_keys;
5697 int major, minor, op, event, error; 5697 int major, minor, op, event, error_code;
5698 5698
5699 BLOCK_INPUT; 5699 BLOCK_INPUT;
5700 5700
@@ -5710,7 +5710,7 @@ present and mapped to the usual X keysyms. */)
5710 /* Check that the server supports XKB. */ 5710 /* Check that the server supports XKB. */
5711 major = XkbMajorVersion; 5711 major = XkbMajorVersion;
5712 minor = XkbMinorVersion; 5712 minor = XkbMinorVersion;
5713 if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) 5713 if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor))
5714 { 5714 {
5715 UNBLOCK_INPUT; 5715 UNBLOCK_INPUT;
5716 return Qlambda; 5716 return Qlambda;
diff --git a/src/xmenu.c b/src/xmenu.c
index 8967437a376..eab7bb03f20 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -124,11 +124,11 @@ static int update_frame_menubar (struct frame *);
124 Xt on behalf of one of the widget sets. */ 124 Xt on behalf of one of the widget sets. */
125static int popup_activated_flag; 125static int popup_activated_flag;
126 126
127static int next_menubar_widget_id;
128
129 127
130#ifdef USE_X_TOOLKIT 128#ifdef USE_X_TOOLKIT
131 129
130static int next_menubar_widget_id;
131
132/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ 132/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */
133 133
134static struct frame * 134static struct frame *
@@ -723,7 +723,7 @@ show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help)
723 unhighlighting. */ 723 unhighlighting. */
724 724
725#ifdef USE_GTK 725#ifdef USE_GTK
726void 726static void
727menu_highlight_callback (GtkWidget *widget, gpointer call_data) 727menu_highlight_callback (GtkWidget *widget, gpointer call_data)
728{ 728{
729 xg_menu_item_cb_data *cb_data; 729 xg_menu_item_cb_data *cb_data;
@@ -742,7 +742,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data)
742 show_help_event (cb_data->cl_data->f, widget, help); 742 show_help_event (cb_data->cl_data->f, widget, help);
743} 743}
744#else 744#else
745void 745static void
746menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) 746menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data)
747{ 747{
748 struct frame *f; 748 struct frame *f;
@@ -1175,8 +1175,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1175 } 1175 }
1176 else 1176 else
1177 { 1177 {
1178 GtkWidget *wvbox = f->output_data.x->vbox_widget;
1179
1180 menubar_widget 1178 menubar_widget
1181 = xg_create_widget ("menubar", "menubar", f, first_wv, 1179 = xg_create_widget ("menubar", "menubar", f, first_wv,
1182 G_CALLBACK (menubar_selection_callback), 1180 G_CALLBACK (menubar_selection_callback),
@@ -1600,7 +1598,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1600 1598
1601Lisp_Object 1599Lisp_Object
1602xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 1600xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1603 Lisp_Object title, const char **error, EMACS_UINT timestamp) 1601 Lisp_Object title, const char **error_name, EMACS_UINT timestamp)
1604{ 1602{
1605 int i; 1603 int i;
1606 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1604 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -1615,11 +1613,11 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1615 if (! FRAME_X_P (f)) 1613 if (! FRAME_X_P (f))
1616 abort (); 1614 abort ();
1617 1615
1618 *error = NULL; 1616 *error_name = NULL;
1619 1617
1620 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) 1618 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
1621 { 1619 {
1622 *error = "Empty menu"; 1620 *error_name = "Empty menu";
1623 return Qnil; 1621 return Qnil;
1624 } 1622 }
1625 1623
@@ -1664,7 +1662,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1664 { 1662 {
1665 /* Create a new pane. */ 1663 /* Create a new pane. */
1666 Lisp_Object pane_name, prefix; 1664 Lisp_Object pane_name, prefix;
1667 char *pane_string; 1665 const char *pane_string;
1668 1666
1669 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); 1667 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
1670 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); 1668 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
@@ -2012,7 +2010,7 @@ xdialog_show (FRAME_PTR f,
2012 representing the text label and buttons. */ 2010 representing the text label and buttons. */
2013 { 2011 {
2014 Lisp_Object pane_name, prefix; 2012 Lisp_Object pane_name, prefix;
2015 char *pane_string; 2013 const char *pane_string;
2016 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; 2014 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
2017 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; 2015 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
2018 pane_string = (NILP (pane_name) 2016 pane_string = (NILP (pane_name)
@@ -2307,7 +2305,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2307 { 2305 {
2308 /* Create a new pane. */ 2306 /* Create a new pane. */
2309 Lisp_Object pane_name, prefix; 2307 Lisp_Object pane_name, prefix;
2310 char *pane_string; 2308 const char *pane_string;
2311 2309
2312 maxlines = max (maxlines, lines); 2310 maxlines = max (maxlines, lines);
2313 lines = 0; 2311 lines = 0;
diff --git a/src/xrdb.c b/src/xrdb.c
index 9fb3f3474fb..63e5851979c 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -28,6 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include <stdio.h> 28#include <stdio.h>
29#include <setjmp.h> 29#include <setjmp.h>
30 30
31#include "lisp.h"
32
33/* This may include sys/types.h, and that somehow loses
34 if this is not done before the other system files. */
35#include "xterm.h"
36
31#include <X11/Xlib.h> 37#include <X11/Xlib.h>
32#include <X11/Xatom.h> 38#include <X11/Xatom.h>
33#include <X11/X.h> 39#include <X11/X.h>
@@ -38,8 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#endif 44#endif
39#include <sys/stat.h> 45#include <sys/stat.h>
40 46
41#include "lisp.h"
42
43#ifdef USE_MOTIF 47#ifdef USE_MOTIF
44/* For Vdouble_click_time. */ 48/* For Vdouble_click_time. */
45#include "keyboard.h" 49#include "keyboard.h"
diff --git a/src/xselect.c b/src/xselect.c
index a502a74f904..5254fa96838 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -97,7 +97,6 @@ static Lisp_Object clean_local_selection_data (Lisp_Object);
97#define TRACE0(fmt) (void) 0 97#define TRACE0(fmt) (void) 0
98#define TRACE1(fmt, a0) (void) 0 98#define TRACE1(fmt, a0) (void) 0
99#define TRACE2(fmt, a0, a1) (void) 0 99#define TRACE2(fmt, a0, a1) (void) 0
100#define TRACE3(fmt, a0, a1) (void) 0
101#endif 100#endif
102 101
103 102
@@ -330,7 +329,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
330 struct frame *sf = SELECTED_FRAME (); 329 struct frame *sf = SELECTED_FRAME ();
331 Window selecting_window; 330 Window selecting_window;
332 Display *display; 331 Display *display;
333 Time time = last_event_timestamp; 332 Time timestamp = last_event_timestamp;
334 Atom selection_atom; 333 Atom selection_atom;
335 struct x_display_info *dpyinfo; 334 struct x_display_info *dpyinfo;
336 335
@@ -346,7 +345,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
346 345
347 BLOCK_INPUT; 346 BLOCK_INPUT;
348 x_catch_errors (display); 347 x_catch_errors (display);
349 XSetSelectionOwner (display, selection_atom, selecting_window, time); 348 XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
350 x_check_errors (display, "Can't set selection: %s"); 349 x_check_errors (display, "Can't set selection: %s");
351 x_uncatch_errors (); 350 x_uncatch_errors ();
352 UNBLOCK_INPUT; 351 UNBLOCK_INPUT;
@@ -357,7 +356,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
357 Lisp_Object selection_data; 356 Lisp_Object selection_data;
358 Lisp_Object prev_value; 357 Lisp_Object prev_value;
359 358
360 selection_time = long_to_cons ((unsigned long) time); 359 selection_time = long_to_cons ((unsigned long) timestamp);
361 selection_data = list4 (selection_name, selection_value, 360 selection_data = list4 (selection_name, selection_value,
362 selection_time, selected_frame); 361 selection_time, selected_frame);
363 prev_value = assq_no_quit (selection_name, Vselection_alist); 362 prev_value = assq_no_quit (selection_name, Vselection_alist);
@@ -2085,7 +2084,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
2085 Sx_disown_selection_internal, 1, 2, 0, 2084 Sx_disown_selection_internal, 1, 2, 0,
2086 doc: /* If we own the selection SELECTION, disown it. 2085 doc: /* If we own the selection SELECTION, disown it.
2087Disowning it means there is no such selection. */) 2086Disowning it means there is no such selection. */)
2088 (Lisp_Object selection, Lisp_Object time) 2087 (Lisp_Object selection, Lisp_Object time_object)
2089{ 2088{
2090 Time timestamp; 2089 Time timestamp;
2091 Atom selection_atom; 2090 Atom selection_atom;
@@ -2104,10 +2103,10 @@ Disowning it means there is no such selection. */)
2104 display = FRAME_X_DISPLAY (sf); 2103 display = FRAME_X_DISPLAY (sf);
2105 dpyinfo = FRAME_X_DISPLAY_INFO (sf); 2104 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
2106 CHECK_SYMBOL (selection); 2105 CHECK_SYMBOL (selection);
2107 if (NILP (time)) 2106 if (NILP (time_object))
2108 timestamp = last_event_timestamp; 2107 timestamp = last_event_timestamp;
2109 else 2108 else
2110 timestamp = cons_to_long (time); 2109 timestamp = cons_to_long (time_object);
2111 2110
2112 if (NILP (assq_no_quit (selection, Vselection_alist))) 2111 if (NILP (assq_no_quit (selection, Vselection_alist)))
2113 return Qnil; /* Don't disown the selection when we're not the owner. */ 2112 return Qnil; /* Don't disown the selection when we're not the owner. */
@@ -2131,26 +2130,6 @@ Disowning it means there is no such selection. */)
2131 return Qt; 2130 return Qt;
2132} 2131}
2133 2132
2134/* Get rid of all the selections in buffer BUFFER.
2135 This is used when we kill a buffer. */
2136
2137void
2138x_disown_buffer_selections (Lisp_Object buffer)
2139{
2140 Lisp_Object tail;
2141 struct buffer *buf = XBUFFER (buffer);
2142
2143 for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail))
2144 {
2145 Lisp_Object elt, value;
2146 elt = XCAR (tail);
2147 value = XCDR (elt);
2148 if (CONSP (value) && MARKERP (XCAR (value))
2149 && XMARKER (XCAR (value))->buffer == buf)
2150 Fx_disown_selection_internal (XCAR (elt), Qnil);
2151 }
2152}
2153
2154DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 2133DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
2155 0, 1, 0, 2134 0, 1, 0,
2156 doc: /* Whether the current Emacs process owns the given X Selection. 2135 doc: /* Whether the current Emacs process owns the given X Selection.
@@ -2455,7 +2434,6 @@ x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_disp
2455 2434
2456 if (event->format == 32 && event->format < BITS_PER_LONG) 2435 if (event->format == 32 && event->format < BITS_PER_LONG)
2457 { 2436 {
2458 int i;
2459 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ 2437 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2460 idata[i] = (int) event->data.l[i]; 2438 idata[i] = (int) event->data.l[i];
2461 data = (unsigned char *) idata; 2439 data = (unsigned char *) idata;
diff --git a/src/xterm.c b/src/xterm.c
index bb792d8b9a7..fd7ffd68e62 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -279,10 +279,6 @@ Lisp_Object Qx_gtk_map_stock;
279/* Some functions take this as char *, not const char *. */ 279/* Some functions take this as char *, not const char *. */
280static char emacs_class[] = EMACS_CLASS; 280static char emacs_class[] = EMACS_CLASS;
281 281
282/* XEmbed implementation. */
283
284#define XEMBED_VERSION 0
285
286enum xembed_info 282enum xembed_info
287 { 283 {
288 XEMBED_MAPPED = 1 << 0 284 XEMBED_MAPPED = 1 << 0
@@ -321,6 +317,7 @@ static void XTframe_up_to_date (struct frame *);
321static void XTset_terminal_modes (struct terminal *); 317static void XTset_terminal_modes (struct terminal *);
322static void XTreset_terminal_modes (struct terminal *); 318static void XTreset_terminal_modes (struct terminal *);
323static void x_clear_frame (struct frame *); 319static void x_clear_frame (struct frame *);
320static void x_ins_del_lines (struct frame *, int, int) NO_RETURN;
324static void frame_highlight (struct frame *); 321static void frame_highlight (struct frame *);
325static void frame_unhighlight (struct frame *); 322static void frame_unhighlight (struct frame *);
326static void x_new_focus_frame (struct x_display_info *, struct frame *); 323static void x_new_focus_frame (struct x_display_info *, struct frame *);
@@ -877,6 +874,7 @@ static void x_draw_glyph_string_foreground (struct glyph_string *);
877static void x_draw_composite_glyph_string_foreground (struct glyph_string *); 874static void x_draw_composite_glyph_string_foreground (struct glyph_string *);
878static void x_draw_glyph_string_box (struct glyph_string *); 875static void x_draw_glyph_string_box (struct glyph_string *);
879static void x_draw_glyph_string (struct glyph_string *); 876static void x_draw_glyph_string (struct glyph_string *);
877static void x_delete_glyphs (struct frame *, int) NO_RETURN;
880static void x_compute_glyph_string_overhangs (struct glyph_string *); 878static void x_compute_glyph_string_overhangs (struct glyph_string *);
881static void x_set_cursor_gc (struct glyph_string *); 879static void x_set_cursor_gc (struct glyph_string *);
882static void x_set_mode_line_face_gc (struct glyph_string *); 880static void x_set_mode_line_face_gc (struct glyph_string *);
@@ -1791,27 +1789,6 @@ x_copy_color (struct frame *f, long unsigned int pixel)
1791} 1789}
1792 1790
1793 1791
1794/* Allocate color PIXEL on display DPY. PIXEL must already be allocated.
1795 It's necessary to do this instead of just using PIXEL directly to
1796 get color reference counts right. */
1797
1798unsigned long
1799x_copy_dpy_color (Display *dpy, Colormap cmap, long unsigned int pixel)
1800{
1801 XColor color;
1802
1803 color.pixel = pixel;
1804 BLOCK_INPUT;
1805 XQueryColor (dpy, cmap, &color);
1806 XAllocColor (dpy, cmap, &color);
1807 UNBLOCK_INPUT;
1808#ifdef DEBUG_X_COLORS
1809 register_color (pixel);
1810#endif
1811 return color.pixel;
1812}
1813
1814
1815/* Brightness beyond which a color won't have its highlight brightness 1792/* Brightness beyond which a color won't have its highlight brightness
1816 boosted. 1793 boosted.
1817 1794
@@ -2260,12 +2237,12 @@ x_draw_image_foreground (struct glyph_string *s)
2260 nothing here for mouse-face. */ 2237 nothing here for mouse-face. */
2261 if (s->hl == DRAW_CURSOR) 2238 if (s->hl == DRAW_CURSOR)
2262 { 2239 {
2263 int r = s->img->relief; 2240 int relief = s->img->relief;
2264 if (r < 0) r = -r; 2241 if (relief < 0) relief = -relief;
2265 XDrawRectangle (s->display, s->window, s->gc, 2242 XDrawRectangle (s->display, s->window, s->gc,
2266 x - r, y - r, 2243 x - relief, y - relief,
2267 s->slice.width + r*2 - 1, 2244 s->slice.width + relief*2 - 1,
2268 s->slice.height + r*2 - 1); 2245 s->slice.height + relief*2 - 1);
2269 } 2246 }
2270 } 2247 }
2271 } 2248 }
@@ -2907,7 +2884,7 @@ x_draw_glyph_string (struct glyph_string *s)
2907 2884
2908/* Shift display to make room for inserted glyphs. */ 2885/* Shift display to make room for inserted glyphs. */
2909 2886
2910void 2887static void
2911x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) 2888x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by)
2912{ 2889{
2913 XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), 2890 XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f),
@@ -3011,7 +2988,7 @@ timeval_subtract (struct timeval *result, struct timeval x, struct timeval y)
3011 return x.tv_sec < y.tv_sec; 2988 return x.tv_sec < y.tv_sec;
3012} 2989}
3013 2990
3014void 2991static void
3015XTflash (struct frame *f) 2992XTflash (struct frame *f)
3016{ 2993{
3017 BLOCK_INPUT; 2994 BLOCK_INPUT;
@@ -3202,7 +3179,7 @@ XTtoggle_invisible_pointer (FRAME_PTR f, int invisible)
3202 3179
3203/* Make audible bell. */ 3180/* Make audible bell. */
3204 3181
3205void 3182static void
3206XTring_bell (struct frame *f) 3183XTring_bell (struct frame *f)
3207{ 3184{
3208 if (FRAME_X_DISPLAY (f)) 3185 if (FRAME_X_DISPLAY (f))
@@ -3816,7 +3793,7 @@ redo_mouse_highlight (void)
3816 mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell 3793 mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell
3817 the mouse is over. 3794 the mouse is over.
3818 3795
3819 Set *TIME to the server time-stamp for the time at which the mouse 3796 Set *TIMESTAMP to the server time-stamp for the time at which the mouse
3820 was at this position. 3797 was at this position.
3821 3798
3822 Don't store anything if we don't have a valid set of values to report. 3799 Don't store anything if we don't have a valid set of values to report.
@@ -3825,14 +3802,16 @@ redo_mouse_highlight (void)
3825 movement. */ 3802 movement. */
3826 3803
3827static void 3804static void
3828XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) 3805XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3806 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3807 long unsigned int *timestamp)
3829{ 3808{
3830 FRAME_PTR f1; 3809 FRAME_PTR f1;
3831 3810
3832 BLOCK_INPUT; 3811 BLOCK_INPUT;
3833 3812
3834 if (! NILP (last_mouse_scroll_bar) && insist == 0) 3813 if (! NILP (last_mouse_scroll_bar) && insist == 0)
3835 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); 3814 x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp);
3836 else 3815 else
3837 { 3816 {
3838 Window root; 3817 Window root;
@@ -4005,7 +3984,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol
4005 *fp = f1; 3984 *fp = f1;
4006 XSETINT (*x, win_x); 3985 XSETINT (*x, win_x);
4007 XSETINT (*y, win_y); 3986 XSETINT (*y, win_y);
4008 *time = last_mouse_movement_time; 3987 *timestamp = last_mouse_movement_time;
4009 } 3988 }
4010 } 3989 }
4011 } 3990 }
@@ -5557,7 +5536,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5557 on the scroll bar. */ 5536 on the scroll bar. */
5558 5537
5559static void 5538static void
5560x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) 5539x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5540 enum scroll_bar_part *part, Lisp_Object *x,
5541 Lisp_Object *y, long unsigned int *timestamp)
5561{ 5542{
5562 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 5543 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
5563 Window w = bar->x_window; 5544 Window w = bar->x_window;
@@ -5617,7 +5598,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_
5617 last_mouse_scroll_bar = Qnil; 5598 last_mouse_scroll_bar = Qnil;
5618 } 5599 }
5619 5600
5620 *time = last_mouse_movement_time; 5601 *timestamp = last_mouse_movement_time;
5621 5602
5622 UNBLOCK_INPUT; 5603 UNBLOCK_INPUT;
5623} 5604}
@@ -5791,7 +5772,8 @@ static void xembed_send_message (struct frame *f, Time time,
5791 We return the number of characters stored into the buffer. */ 5772 We return the number of characters stored into the buffer. */
5792 5773
5793static int 5774static int
5794handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) 5775handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5776 int *finish, struct input_event *hold_quit)
5795{ 5777{
5796 union { 5778 union {
5797 struct input_event ie; 5779 struct input_event ie;
@@ -5802,7 +5784,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
5802 int nbytes = 0; 5784 int nbytes = 0;
5803 struct frame *f = NULL; 5785 struct frame *f = NULL;
5804 struct coding_system coding; 5786 struct coding_system coding;
5805 XEvent event = *eventp; 5787 XEvent event = *eventptr;
5806 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; 5788 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5807 5789
5808 *finish = X_EVENT_NORMAL; 5790 *finish = X_EVENT_NORMAL;
@@ -6502,7 +6484,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6502 6484
6503 { /* Raw bytes, not keysym. */ 6485 { /* Raw bytes, not keysym. */
6504 register int i; 6486 register int i;
6505 register int c;
6506 int nchars, len; 6487 int nchars, len;
6507 6488
6508 for (i = 0, nchars = 0; i < nbytes; i++) 6489 for (i = 0, nchars = 0; i < nbytes; i++)
@@ -6542,14 +6523,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6542 character events. */ 6523 character events. */
6543 for (i = 0; i < nbytes; i += len) 6524 for (i = 0; i < nbytes; i += len)
6544 { 6525 {
6526 int ch;
6545 if (nchars == nbytes) 6527 if (nchars == nbytes)
6546 c = copy_bufptr[i], len = 1; 6528 ch = copy_bufptr[i], len = 1;
6547 else 6529 else
6548 c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); 6530 ch = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len);
6549 inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) 6531 inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch)
6550 ? ASCII_KEYSTROKE_EVENT 6532 ? ASCII_KEYSTROKE_EVENT
6551 : MULTIBYTE_CHAR_KEYSTROKE_EVENT); 6533 : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
6552 inev.ie.code = c; 6534 inev.ie.code = ch;
6553 kbd_buffer_store_event_hold (&inev.ie, hold_quit); 6535 kbd_buffer_store_event_hold (&inev.ie, hold_quit);
6554 } 6536 }
6555 6537
@@ -6988,7 +6970,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6988 count++; 6970 count++;
6989 } 6971 }
6990 6972
6991 *eventp = event; 6973 *eventptr = event;
6992 return count; 6974 return count;
6993} 6975}
6994 6976
@@ -7028,7 +7010,6 @@ static int
7028XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) 7010XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit)
7029{ 7011{
7030 int count = 0; 7012 int count = 0;
7031 XEvent event;
7032 int event_found = 0; 7013 int event_found = 0;
7033 7014
7034 if (interrupt_input_blocked) 7015 if (interrupt_input_blocked)
@@ -7062,6 +7043,7 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
7062 while (XPending (terminal->display_info.x->display)) 7043 while (XPending (terminal->display_info.x->display))
7063 { 7044 {
7064 int finish; 7045 int finish;
7046 XEvent event;
7065 7047
7066 XNextEvent (terminal->display_info.x->display, &event); 7048 XNextEvent (terminal->display_info.x->display, &event);
7067 7049
@@ -7079,6 +7061,8 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
7079 goto out; 7061 goto out;
7080 } 7062 }
7081 7063
7064 out:;
7065
7082#else /* USE_GTK */ 7066#else /* USE_GTK */
7083 7067
7084 /* For GTK we must use the GTK event loop. But XEvents gets passed 7068 /* For GTK we must use the GTK event loop. But XEvents gets passed
@@ -7105,8 +7089,6 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
7105 } 7089 }
7106#endif /* USE_GTK */ 7090#endif /* USE_GTK */
7107 7091
7108 out:;
7109
7110 /* On some systems, an X bug causes Emacs to get no more events 7092 /* On some systems, an X bug causes Emacs to get no more events
7111 when the window is destroyed. Detect that. (1994.) */ 7093 when the window is destroyed. Detect that. (1994.) */
7112 if (! event_found) 7094 if (! event_found)
@@ -7242,9 +7224,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
7242 the bar might not be in the window. */ 7224 the bar might not be in the window. */
7243 if (cursor_glyph->type == IMAGE_GLYPH) 7225 if (cursor_glyph->type == IMAGE_GLYPH)
7244 { 7226 {
7245 struct glyph_row *row; 7227 struct glyph_row *r;
7246 row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); 7228 r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos);
7247 draw_phys_cursor_glyph (w, row, DRAW_CURSOR); 7229 draw_phys_cursor_glyph (w, r, DRAW_CURSOR);
7248 } 7230 }
7249 else 7231 else
7250 { 7232 {
@@ -7533,9 +7515,9 @@ static struct x_error_message_stack *x_error_message;
7533 x_catch_errors is in effect. */ 7515 x_catch_errors is in effect. */
7534 7516
7535static void 7517static void
7536x_error_catcher (Display *display, XErrorEvent *error) 7518x_error_catcher (Display *display, XErrorEvent *event)
7537{ 7519{
7538 XGetErrorText (display, error->error_code, 7520 XGetErrorText (display, event->error_code,
7539 x_error_message->string, 7521 x_error_message->string,
7540 X_ERROR_MESSAGE_SIZE); 7522 X_ERROR_MESSAGE_SIZE);
7541} 7523}
@@ -7684,17 +7666,6 @@ x_connection_signal (int signalnum) /* If we don't have an argument, */
7684 7666
7685static char *error_msg; 7667static char *error_msg;
7686 7668
7687/* Function installed as fatal_error_signal_hook in
7688 x_connection_closed. Print the X error message, and exit normally,
7689 instead of dumping core when XtCloseDisplay fails. */
7690
7691static void
7692x_fatal_error_signal (void)
7693{
7694 fprintf (stderr, "%s\n", error_msg);
7695 exit (70);
7696}
7697
7698/* Handle the loss of connection to display DPY. ERROR_MESSAGE is 7669/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
7699 the text of an error message that lead to the connection loss. */ 7670 the text of an error message that lead to the connection loss. */
7700 7671
@@ -7703,7 +7674,7 @@ x_connection_closed (Display *dpy, const char *error_message)
7703{ 7674{
7704 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 7675 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
7705 Lisp_Object frame, tail; 7676 Lisp_Object frame, tail;
7706 int index = SPECPDL_INDEX (); 7677 int idx = SPECPDL_INDEX ();
7707 7678
7708 error_msg = (char *) alloca (strlen (error_message) + 1); 7679 error_msg = (char *) alloca (strlen (error_message) + 1);
7709 strcpy (error_msg, error_message); 7680 strcpy (error_msg, error_message);
@@ -7798,8 +7769,12 @@ For details, see etc/PROBLEMS.\n",
7798 sigunblock (sigmask (SIGALRM)); 7769 sigunblock (sigmask (SIGALRM));
7799 TOTALLY_UNBLOCK_INPUT; 7770 TOTALLY_UNBLOCK_INPUT;
7800 7771
7801 unbind_to (index, Qnil); 7772 unbind_to (idx, Qnil);
7802 clear_waiting_for_input (); 7773 clear_waiting_for_input ();
7774
7775 /* Tell GCC not to suggest attribute 'noreturn' for this function. */
7776 IF_LINT (if (! terminal_list) return; )
7777
7803 /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, 7778 /* Here, we absolutely have to use a non-local exit (e.g. signal, throw,
7804 longjmp), because returning from this function would get us back into 7779 longjmp), because returning from this function would get us back into
7805 Xlib's code which will directly call `exit'. */ 7780 Xlib's code which will directly call `exit'. */
@@ -7814,12 +7789,12 @@ static void x_error_quitter (Display *, XErrorEvent *);
7814 It calls x_error_quitter or x_error_catcher. */ 7789 It calls x_error_quitter or x_error_catcher. */
7815 7790
7816static int 7791static int
7817x_error_handler (Display *display, XErrorEvent *error) 7792x_error_handler (Display *display, XErrorEvent *event)
7818{ 7793{
7819 if (x_error_message) 7794 if (x_error_message)
7820 x_error_catcher (display, error); 7795 x_error_catcher (display, event);
7821 else 7796 else
7822 x_error_quitter (display, error); 7797 x_error_quitter (display, event);
7823 return 0; 7798 return 0;
7824} 7799}
7825 7800
@@ -7833,22 +7808,22 @@ x_error_handler (Display *display, XErrorEvent *error)
7833 after x_error_handler prevents inlining into the former. */ 7808 after x_error_handler prevents inlining into the former. */
7834 7809
7835static void NO_INLINE 7810static void NO_INLINE
7836x_error_quitter (Display *display, XErrorEvent *error) 7811x_error_quitter (Display *display, XErrorEvent *event)
7837{ 7812{
7838 char buf[256], buf1[356]; 7813 char buf[256], buf1[356];
7839 7814
7840 /* Ignore BadName errors. They can happen because of fonts 7815 /* Ignore BadName errors. They can happen because of fonts
7841 or colors that are not defined. */ 7816 or colors that are not defined. */
7842 7817
7843 if (error->error_code == BadName) 7818 if (event->error_code == BadName)
7844 return; 7819 return;
7845 7820
7846 /* Note that there is no real way portable across R3/R4 to get the 7821 /* Note that there is no real way portable across R3/R4 to get the
7847 original error handler. */ 7822 original error handler. */
7848 7823
7849 XGetErrorText (display, error->error_code, buf, sizeof (buf)); 7824 XGetErrorText (display, event->error_code, buf, sizeof (buf));
7850 sprintf (buf1, "X protocol error: %s on protocol request %d", 7825 sprintf (buf1, "X protocol error: %s on protocol request %d",
7851 buf, error->request_code); 7826 buf, event->request_code);
7852 x_connection_closed (display, buf1); 7827 x_connection_closed (display, buf1);
7853} 7828}
7854 7829
@@ -8135,7 +8110,7 @@ xim_close_dpy (struct x_display_info *dpyinfo)
8135/* Calculate the absolute position in frame F 8110/* Calculate the absolute position in frame F
8136 from its current recorded position values and gravity. */ 8111 from its current recorded position values and gravity. */
8137 8112
8138void 8113static void
8139x_calc_absolute_position (struct frame *f) 8114x_calc_absolute_position (struct frame *f)
8140{ 8115{
8141 int flags = f->size_hint_flags; 8116 int flags = f->size_hint_flags;
@@ -8878,31 +8853,6 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
8878 UNBLOCK_INPUT; 8853 UNBLOCK_INPUT;
8879} 8854}
8880 8855
8881/* focus shifting, raising and lowering. */
8882
8883void
8884x_focus_on_frame (struct frame *f)
8885{
8886#if 0
8887 /* I don't think that the ICCCM allows programs to do things like this
8888 without the interaction of the window manager. Whatever you end up
8889 doing with this code, do it to x_unfocus_frame too. */
8890 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8891 RevertToPointerRoot, CurrentTime);
8892#endif /* ! 0 */
8893}
8894
8895void
8896x_unfocus_frame (struct frame *f)
8897{
8898#if 0
8899 /* Look at the remarks in x_focus_on_frame. */
8900 if (FRAME_X_DISPLAY_INFO (f)->x_focus_frame == f)
8901 XSetInputFocus (FRAME_X_DISPLAY (f), PointerRoot,
8902 RevertToPointerRoot, CurrentTime);
8903#endif /* ! 0 */
8904}
8905
8906/* Raise frame F. */ 8856/* Raise frame F. */
8907 8857
8908void 8858void
@@ -8963,6 +8913,12 @@ XTframe_raise_lower (FRAME_PTR f, int raise_flag)
8963 8913
8964/* XEmbed implementation. */ 8914/* XEmbed implementation. */
8965 8915
8916#if defined USE_X_TOOLKIT || ! defined USE_GTK
8917
8918/* XEmbed implementation. */
8919
8920#define XEMBED_VERSION 0
8921
8966static void 8922static void
8967xembed_set_info (struct frame *f, enum xembed_info flags) 8923xembed_set_info (struct frame *f, enum xembed_info flags)
8968{ 8924{
@@ -8976,9 +8932,11 @@ xembed_set_info (struct frame *f, enum xembed_info flags)
8976 dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 8932 dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO,
8977 32, PropModeReplace, (unsigned char *) data, 2); 8933 32, PropModeReplace, (unsigned char *) data, 2);
8978} 8934}
8935#endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */
8979 8936
8980static void 8937static void
8981xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) 8938xembed_send_message (struct frame *f, Time t, enum xembed_message msg,
8939 long int detail, long int data1, long int data2)
8982{ 8940{
8983 XEvent event; 8941 XEvent event;
8984 8942
@@ -8986,8 +8944,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo
8986 event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; 8944 event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc;
8987 event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; 8945 event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED;
8988 event.xclient.format = 32; 8946 event.xclient.format = 32;
8989 event.xclient.data.l[0] = time; 8947 event.xclient.data.l[0] = t;
8990 event.xclient.data.l[1] = message; 8948 event.xclient.data.l[1] = msg;
8991 event.xclient.data.l[2] = detail; 8949 event.xclient.data.l[2] = detail;
8992 event.xclient.data.l[3] = data1; 8950 event.xclient.data.l[3] = data1;
8993 event.xclient.data.l[4] = data2; 8951 event.xclient.data.l[4] = data2;
@@ -9228,7 +9186,9 @@ x_make_frame_invisible (struct frame *f)
9228void 9186void
9229x_iconify_frame (struct frame *f) 9187x_iconify_frame (struct frame *f)
9230{ 9188{
9189#ifdef USE_X_TOOLKIT
9231 int result; 9190 int result;
9191#endif
9232 Lisp_Object type; 9192 Lisp_Object type;
9233 9193
9234 /* Don't keep the highlight on an invisible frame. */ 9194 /* Don't keep the highlight on an invisible frame. */
@@ -9311,19 +9271,19 @@ x_iconify_frame (struct frame *f)
9311 /* X11R4: send a ClientMessage to the window manager using the 9271 /* X11R4: send a ClientMessage to the window manager using the
9312 WM_CHANGE_STATE type. */ 9272 WM_CHANGE_STATE type. */
9313 { 9273 {
9314 XEvent message; 9274 XEvent msg;
9315 9275
9316 message.xclient.window = FRAME_X_WINDOW (f); 9276 msg.xclient.window = FRAME_X_WINDOW (f);
9317 message.xclient.type = ClientMessage; 9277 msg.xclient.type = ClientMessage;
9318 message.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; 9278 msg.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state;
9319 message.xclient.format = 32; 9279 msg.xclient.format = 32;
9320 message.xclient.data.l[0] = IconicState; 9280 msg.xclient.data.l[0] = IconicState;
9321 9281
9322 if (! XSendEvent (FRAME_X_DISPLAY (f), 9282 if (! XSendEvent (FRAME_X_DISPLAY (f),
9323 DefaultRootWindow (FRAME_X_DISPLAY (f)), 9283 DefaultRootWindow (FRAME_X_DISPLAY (f)),
9324 False, 9284 False,
9325 SubstructureRedirectMask | SubstructureNotifyMask, 9285 SubstructureRedirectMask | SubstructureNotifyMask,
9326 &message)) 9286 &msg))
9327 { 9287 {
9328 UNBLOCK_INPUT_RESIGNAL; 9288 UNBLOCK_INPUT_RESIGNAL;
9329 error ("Can't notify window manager of iconification"); 9289 error ("Can't notify window manager of iconification");
@@ -9355,9 +9315,11 @@ void
9355x_free_frame_resources (struct frame *f) 9315x_free_frame_resources (struct frame *f)
9356{ 9316{
9357 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 9317 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
9318 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
9319#ifdef USE_X_TOOLKIT
9358 Lisp_Object bar; 9320 Lisp_Object bar;
9359 struct scroll_bar *b; 9321 struct scroll_bar *b;
9360 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; 9322#endif
9361 9323
9362 BLOCK_INPUT; 9324 BLOCK_INPUT;
9363 9325
@@ -9813,10 +9775,11 @@ x_display_ok (const char *display)
9813 9775
9814#ifdef USE_GTK 9776#ifdef USE_GTK
9815static void 9777static void
9816my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) 9778my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
9779 const gchar *msg, gpointer user_data)
9817{ 9780{
9818 if (!strstr (message, "g_set_prgname")) 9781 if (!strstr (msg, "g_set_prgname"))
9819 fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); 9782 fprintf (stderr, "%s-WARNING **: %s\n", log_domain, msg);
9820} 9783}
9821#endif 9784#endif
9822 9785
diff --git a/src/xterm.h b/src/xterm.h
index ee17cfe2bd5..15630e902e5 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -990,6 +990,7 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
990extern void x_query_colors (struct frame *f, XColor *, int); 990extern void x_query_colors (struct frame *f, XColor *, int);
991extern void x_query_color (struct frame *f, XColor *); 991extern void x_query_color (struct frame *f, XColor *);
992extern void x_clear_area (Display *, Window, int, int, int, int, int); 992extern void x_clear_area (Display *, Window, int, int, int, int, int);
993extern void x_mouse_leave (struct x_display_info *);
993extern void set_vertical_scroll_bar (struct window *); 994extern void set_vertical_scroll_bar (struct window *);
994 995
995extern int x_dispatch_event (XEvent *, Display *); 996extern int x_dispatch_event (XEvent *, Display *);