aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorPaul Eggert2011-03-08 18:12:00 -0800
committerPaul Eggert2011-03-08 18:12:00 -0800
commitfbceeba21b3b5aeb2a0f98d4ca937cabbe07fab0 (patch)
tree8b6d211a9e0ed7b1ac2a07bcc515d3e357a4f79d /src/term.c
parent50938595880fd87c7dcd39a607cba1b0a7598baf (diff)
downloademacs-fbceeba21b3b5aeb2a0f98d4ca937cabbe07fab0.tar.gz
emacs-fbceeba21b3b5aeb2a0f98d4ca937cabbe07fab0.zip
* cm.c (calccost, cmgoto): Use const pointers where appropriate.
* cm.h (struct cm): Likewise. * dispextern.h (do_line_insertion_deletion_costs): Likewise. * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise. * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table): (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph): (turn_on_face, init_tty): Likewise. * termchar.h (struct tty_display_info): Likewise. * term.c (tgetflag, tgetnum, tgetstr): Redefine to use const pointers.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/term.c b/src/term.c
index 19d7d893069..6986cfb9e03 100644
--- a/src/term.c
+++ b/src/term.c
@@ -961,9 +961,10 @@ static void
961tty_ins_del_lines (struct frame *f, int vpos, int n) 961tty_ins_del_lines (struct frame *f, int vpos, int n)
962{ 962{
963 struct tty_display_info *tty = FRAME_TTY (f); 963 struct tty_display_info *tty = FRAME_TTY (f);
964 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; 964 const char *multi =
965 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;
966 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;
967 968
968 register int i = n > 0 ? n : -n; 969 register int i = n > 0 ? n : -n;
969 register char *buf; 970 register char *buf;
@@ -1138,9 +1139,9 @@ calculate_costs (struct frame *frame)
1138 if (FRAME_TERMCAP_P (frame)) 1139 if (FRAME_TERMCAP_P (frame))
1139 { 1140 {
1140 struct tty_display_info *tty = FRAME_TTY (frame); 1141 struct tty_display_info *tty = FRAME_TTY (frame);
1141 register char *f = (tty->TS_set_scroll_region 1142 register const char *f = (tty->TS_set_scroll_region
1142 ? tty->TS_set_scroll_region 1143 ? tty->TS_set_scroll_region
1143 : tty->TS_set_scroll_region_1); 1144 : tty->TS_set_scroll_region_1);
1144 1145
1145 FRAME_SCROLL_REGION_COST (frame) = string_cost (f); 1146 FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
1146 1147
@@ -1194,7 +1195,7 @@ calculate_costs (struct frame *frame)
1194} 1195}
1195 1196
1196struct fkey_table { 1197struct fkey_table {
1197 char *cap, *name; 1198 const char *cap, *name;
1198}; 1199};
1199 1200
1200 /* Termcap capability names that correspond directly to X keysyms. 1201 /* Termcap capability names that correspond directly to X keysyms.
@@ -1305,6 +1306,18 @@ static char **term_get_fkeys_address;
1305static KBOARD *term_get_fkeys_kboard; 1306static KBOARD *term_get_fkeys_kboard;
1306static Lisp_Object term_get_fkeys_1 (void); 1307static Lisp_Object term_get_fkeys_1 (void);
1307 1308
1309/* Rework termcap API to accept const pointer args. */
1310static inline int my_tgetflag (const char *x) { return tgetflag ((char *) x); }
1311static inline int my_tgetnum (const char *x) { return tgetnum ((char *) x); }
1312static inline char *my_tgetstr (const char *x, char **a)
1313{ return tgetstr ((char *) x, a); }
1314#undef tgetflag
1315#undef tgetnum
1316#undef tgetstr
1317#define tgetflag my_tgetflag
1318#define tgetnum my_tgetnum
1319#define tgetstr my_tgetstr
1320
1308/* Find the escape codes sent by the function keys for Vinput_decode_map. 1321/* Find the escape codes sent by the function keys for Vinput_decode_map.
1309 This function scans the termcap function key sequence entries, and 1322 This function scans the termcap function key sequence entries, and
1310 adds entries to Vinput_decode_map for each function key it finds. */ 1323 adds entries to Vinput_decode_map for each function key it finds. */
@@ -1352,9 +1365,9 @@ term_get_fkeys_1 (void)
1352 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. 1365 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
1353 */ 1366 */
1354 { 1367 {
1355 char *k_semi = tgetstr ("k;", address); 1368 const char *k_semi = tgetstr ("k;", address);
1356 char *k0 = tgetstr ("k0", address); 1369 const char *k0 = tgetstr ("k0", address);
1357 char *k0_name = "f10"; 1370 const char *k0_name = "f10";
1358 1371
1359 if (k_semi) 1372 if (k_semi)
1360 { 1373 {
@@ -1447,7 +1460,7 @@ static void append_glyph (struct it *);
1447static void produce_stretch_glyph (struct it *); 1460static void produce_stretch_glyph (struct it *);
1448static void append_composite_glyph (struct it *); 1461static void append_composite_glyph (struct it *);
1449static void produce_composite_glyph (struct it *); 1462static void produce_composite_glyph (struct it *);
1450static void append_glyphless_glyph (struct it *, int, char *); 1463static void append_glyphless_glyph (struct it *, int, const char *);
1451static void produce_glyphless_glyph (struct it *, int, Lisp_Object); 1464static void produce_glyphless_glyph (struct it *, int, Lisp_Object);
1452 1465
1453/* Append glyphs to IT's glyph_row. Called from produce_glyphs for 1466/* Append glyphs to IT's glyph_row. Called from produce_glyphs for
@@ -1815,7 +1828,7 @@ produce_composite_glyph (struct it *it)
1815 comes from it->nglyphs bytes). */ 1828 comes from it->nglyphs bytes). */
1816 1829
1817static void 1830static void
1818append_glyphless_glyph (struct it *it, int face_id, char *str) 1831append_glyphless_glyph (struct it *it, int face_id, const char *str)
1819{ 1832{
1820 struct glyph *glyph, *end; 1833 struct glyph *glyph, *end;
1821 int i; 1834 int i;
@@ -1890,7 +1903,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1890{ 1903{
1891 int face_id; 1904 int face_id;
1892 int len; 1905 int len;
1893 char buf[9], *str = " "; 1906 char buf[9];
1907 char const *str = " ";
1894 1908
1895 /* Get a face ID for the glyph by utilizing a cache (the same way as 1909 /* Get a face ID for the glyph by utilizing a cache (the same way as
1896 done for `escape-glyph' in get_next_display_element). */ 1910 done for `escape-glyph' in get_next_display_element). */
@@ -2109,7 +2123,8 @@ turn_on_face (struct frame *f, int face_id)
2109 2123
2110 if (tty->TN_max_colors > 0) 2124 if (tty->TN_max_colors > 0)
2111 { 2125 {
2112 char *ts, *p; 2126 const char *ts;
2127 char *p;
2113 2128
2114 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; 2129 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
2115 if (fg >= 0 && ts) 2130 if (fg >= 0 && ts)
@@ -3519,10 +3534,10 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3519 If it were in the termcap entry, it would confuse other programs. */ 3534 If it were in the termcap entry, it would confuse other programs. */
3520 if (!tty->TS_set_window) 3535 if (!tty->TS_set_window)
3521 { 3536 {
3522 p = tty->TS_termcap_modes; 3537 const char *m = tty->TS_termcap_modes;
3523 while (*p && strcmp (p, "\033v ")) 3538 while (*m && strcmp (m, "\033v "))
3524 p++; 3539 m++;
3525 if (*p) 3540 if (*m)
3526 tty->TS_set_window = "\033v%C %C %C %C "; 3541 tty->TS_set_window = "\033v%C %C %C %C ";
3527 } 3542 }
3528 /* Termcap entry often fails to have :in: flag */ 3543 /* Termcap entry often fails to have :in: flag */