Commit fbceeba2 authored by Paul Eggert's avatar Paul Eggert
Browse files

* 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.
parent 50938595
......@@ -98,6 +98,16 @@
* tparam.c (tparam1, tparam, tgoto):
Use const pointers where appropriate.
 
* 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.
2011-03-06 Chong Yidong <cyd@stupidchicken.com>
 
* xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06
......@@ -199,7 +199,7 @@ calccost (struct tty_display_info *tty,
tabx,
tab2x,
tabcost;
register char *p;
register const char *p;
/* If have just wrapped on a terminal with xn,
don't believe the cursor position: give up here
......@@ -331,8 +331,8 @@ cmgoto (struct tty_display_info *tty, int row, int col)
relcost,
directcost;
int use IF_LINT (= 0);
char *p,
*dcm;
char *p;
const char *dcm;
/* First the degenerate case */
if (row == curY (tty) && col == curX (tty)) /* already there */
......
......@@ -35,25 +35,25 @@ struct cm
int cm_curX; /* Current column */
/* Capabilities from termcap */
char *cm_up; /* up (up) */
char *cm_down; /* down (do) */
char *cm_left; /* left (le) */
char *cm_right; /* right (nd) */
char *cm_home; /* home (ho) */
char *cm_cr; /* carriage return (cr) */
char *cm_ll; /* last line (ll) */
char *cm_tab; /* tab (ta) */
char *cm_backtab; /* backtab (bt) */
const char *cm_up; /* up (up) */
const char *cm_down; /* down (do) */
const char *cm_left; /* left (le) */
const char *cm_right; /* right (nd) */
const char *cm_home; /* home (ho) */
const char *cm_cr; /* carriage return (cr) */
const char *cm_ll; /* last line (ll) */
const char *cm_tab; /* tab (ta) */
const char *cm_backtab; /* backtab (bt) */
char *cm_abs; /* absolute (cm) */
char *cm_habs; /* horizontal absolute (ch) */
char *cm_vabs; /* vertical absolute (cv) */
const char *cm_habs; /* horizontal absolute (ch) */
const char *cm_vabs; /* vertical absolute (cv) */
#if 0
char *cm_ds; /* "don't send" string (ds) */
const char *cm_ds; /* "don't send" string (ds) */
#endif
char *cm_multiup; /* multiple up (UP) */
char *cm_multidown; /* multiple down (DO) */
char *cm_multileft; /* multiple left (LE) */
char *cm_multiright; /* multiple right (RI) */
const char *cm_multiup; /* multiple up (UP) */
const char *cm_multidown; /* multiple down (DO) */
const char *cm_multileft; /* multiple left (LE) */
const char *cm_multiright; /* multiple right (RI) */
int cm_cols; /* number of cols on screen (co) */
int cm_rows; /* number of rows on screen (li) */
int cm_tabwidth; /* tab width (it) */
......@@ -168,4 +168,3 @@ extern void cmcostinit (struct tty_display_info *);
extern void cmgoto (struct tty_display_info *, int, int);
extern void Wcm_clear (struct tty_display_info *);
extern int Wcm_init (struct tty_display_info *);
......@@ -3326,9 +3326,10 @@ extern struct terminal *init_tty (const char *, const char *, int);
extern int scrolling_max_lines_saved (int, int, int *, int *, int *);
extern int scroll_cost (struct frame *, int, int, int);
extern void do_line_insertion_deletion_costs (struct frame *, char *,
char *, char *, char *,
char *, char *, int);
extern void do_line_insertion_deletion_costs (struct frame *, const char *,
const char *, const char *,
const char *, const char *,
const char *, int);
void scrolling_1 (struct frame *, int, int, int, int *, int *, int *,
int *, int);
......
......@@ -938,8 +938,8 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int
static void
ins_del_costs (FRAME_PTR frame,
char *one_line_string, char *multi_string,
char *setup_string, char *cleanup_string,
const char *one_line_string, const char *multi_string,
const char *setup_string, const char *cleanup_string,
int *costvec, int *ncostvec,
int coefficient)
{
......@@ -994,9 +994,12 @@ ins_del_costs (FRAME_PTR frame,
void
do_line_insertion_deletion_costs (FRAME_PTR frame,
char *ins_line_string, char *multi_ins_string,
char *del_line_string, char *multi_del_string,
char *setup_string, char *cleanup_string,
const char *ins_line_string,
const char *multi_ins_string,
const char *del_line_string,
const char *multi_del_string,
const char *setup_string,
const char *cleanup_string,
int coefficient)
{
if (FRAME_INSERT_COST (frame) != 0)
......
......@@ -961,9 +961,10 @@ static void
tty_ins_del_lines (struct frame *f, int vpos, int n)
{
struct tty_display_info *tty = FRAME_TTY (f);
char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
const char *multi =
n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
const char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
const char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
register int i = n > 0 ? n : -n;
register char *buf;
......@@ -1138,9 +1139,9 @@ calculate_costs (struct frame *frame)
if (FRAME_TERMCAP_P (frame))
{
struct tty_display_info *tty = FRAME_TTY (frame);
register char *f = (tty->TS_set_scroll_region
? tty->TS_set_scroll_region
: tty->TS_set_scroll_region_1);
register const char *f = (tty->TS_set_scroll_region
? tty->TS_set_scroll_region
: tty->TS_set_scroll_region_1);
FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
......@@ -1194,7 +1195,7 @@ calculate_costs (struct frame *frame)
}
struct fkey_table {
char *cap, *name;
const char *cap, *name;
};
/* Termcap capability names that correspond directly to X keysyms.
......@@ -1305,6 +1306,18 @@ static char **term_get_fkeys_address;
static KBOARD *term_get_fkeys_kboard;
static Lisp_Object term_get_fkeys_1 (void);
/* Rework termcap API to accept const pointer args. */
static inline int my_tgetflag (const char *x) { return tgetflag ((char *) x); }
static inline int my_tgetnum (const char *x) { return tgetnum ((char *) x); }
static inline char *my_tgetstr (const char *x, char **a)
{ return tgetstr ((char *) x, a); }
#undef tgetflag
#undef tgetnum
#undef tgetstr
#define tgetflag my_tgetflag
#define tgetnum my_tgetnum
#define tgetstr my_tgetstr
/* Find the escape codes sent by the function keys for Vinput_decode_map.
This function scans the termcap function key sequence entries, and
adds entries to Vinput_decode_map for each function key it finds. */
......@@ -1352,9 +1365,9 @@ term_get_fkeys_1 (void)
"k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
*/
{
char *k_semi = tgetstr ("k;", address);
char *k0 = tgetstr ("k0", address);
char *k0_name = "f10";
const char *k_semi = tgetstr ("k;", address);
const char *k0 = tgetstr ("k0", address);
const char *k0_name = "f10";
if (k_semi)
{
......@@ -1447,7 +1460,7 @@ static void append_glyph (struct it *);
static void produce_stretch_glyph (struct it *);
static void append_composite_glyph (struct it *);
static void produce_composite_glyph (struct it *);
static void append_glyphless_glyph (struct it *, int, char *);
static void append_glyphless_glyph (struct it *, int, const char *);
static void produce_glyphless_glyph (struct it *, int, Lisp_Object);
/* Append glyphs to IT's glyph_row. Called from produce_glyphs for
......@@ -1815,7 +1828,7 @@ produce_composite_glyph (struct it *it)
comes from it->nglyphs bytes). */
static void
append_glyphless_glyph (struct it *it, int face_id, char *str)
append_glyphless_glyph (struct it *it, int face_id, const char *str)
{
struct glyph *glyph, *end;
int i;
......@@ -1890,7 +1903,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
{
int face_id;
int len;
char buf[9], *str = " ";
char buf[9];
char const *str = " ";
/* Get a face ID for the glyph by utilizing a cache (the same way as
done for `escape-glyph' in get_next_display_element). */
......@@ -2109,7 +2123,8 @@ turn_on_face (struct frame *f, int face_id)
if (tty->TN_max_colors > 0)
{
char *ts, *p;
const char *ts;
char *p;
ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
if (fg >= 0 && ts)
......@@ -3519,10 +3534,10 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
If it were in the termcap entry, it would confuse other programs. */
if (!tty->TS_set_window)
{
p = tty->TS_termcap_modes;
while (*p && strcmp (p, "\033v "))
p++;
if (*p)
const char *m = tty->TS_termcap_modes;
while (*m && strcmp (m, "\033v "))
m++;
if (*m)
tty->TS_set_window = "\033v%C %C %C %C ";
}
/* Termcap entry often fails to have :in: flag */
......
......@@ -84,58 +84,58 @@ struct tty_display_info
/* Strings, numbers and flags taken from the termcap entry. */
char *TS_ins_line; /* "al" */
char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
char *TS_bell; /* "bl" */
char *TS_clr_to_bottom; /* "cd" */
char *TS_clr_line; /* "ce", clear to end of line */
char *TS_clr_frame; /* "cl" */
char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
const char *TS_ins_line; /* "al" */
const char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
const char *TS_bell; /* "bl" */
const char *TS_clr_to_bottom; /* "cd" */
const char *TS_clr_line; /* "ce", clear to end of line */
const char *TS_clr_frame; /* "cl" */
const char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
const char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
lines above scroll region, lines below it,
total lines again) */
char *TS_del_char; /* "dc" */
char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */
char *TS_del_line; /* "dl" */
char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */
char *TS_delete_mode; /* "dm", enter character-delete mode */
char *TS_end_delete_mode; /* "ed", leave character-delete mode */
char *TS_end_insert_mode; /* "ei", leave character-insert mode */
char *TS_ins_char; /* "ic" */
char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */
char *TS_insert_mode; /* "im", enter character-insert mode */
char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */
char *TS_end_keypad_mode; /* "ke" */
char *TS_keypad_mode; /* "ks" */
char *TS_pad_char; /* "pc", char to use as padding */
char *TS_repeat; /* "rp" (2 params, # times to repeat
const char *TS_del_char; /* "dc" */
const char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */
const char *TS_del_line; /* "dl" */
const char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */
const char *TS_delete_mode; /* "dm", enter character-delete mode */
const char *TS_end_delete_mode; /* "ed", leave character-delete mode */
const char *TS_end_insert_mode; /* "ei", leave character-insert mode */
const char *TS_ins_char; /* "ic" */
const char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */
const char *TS_insert_mode; /* "im", enter character-insert mode */
const char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */
const char *TS_end_keypad_mode; /* "ke" */
const char *TS_keypad_mode; /* "ks" */
const char *TS_pad_char; /* "pc", char to use as padding */
const char *TS_repeat; /* "rp" (2 params, # times to repeat
and character to be repeated) */
char *TS_end_standout_mode; /* "se" */
char *TS_fwd_scroll; /* "sf" */
char *TS_standout_mode; /* "so" */
char *TS_rev_scroll; /* "sr" */
char *TS_end_termcap_modes; /* "te" */
char *TS_termcap_modes; /* "ti" */
char *TS_visible_bell; /* "vb" */
char *TS_cursor_normal; /* "ve" */
char *TS_cursor_visible; /* "vs" */
char *TS_cursor_invisible; /* "vi" */
char *TS_set_window; /* "wi" (4 params, start and end of window,
const char *TS_end_standout_mode; /* "se" */
const char *TS_fwd_scroll; /* "sf" */
const char *TS_standout_mode; /* "so" */
const char *TS_rev_scroll; /* "sr" */
const char *TS_end_termcap_modes; /* "te" */
const char *TS_termcap_modes; /* "ti" */
const char *TS_visible_bell; /* "vb" */
const char *TS_cursor_normal; /* "ve" */
const char *TS_cursor_visible; /* "vs" */
const char *TS_cursor_invisible; /* "vi" */
const char *TS_set_window; /* "wi" (4 params, start and end of window,
each as vpos and hpos) */
char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
char *TS_exit_underline_mode; /* "us" -- start underlining. */
char *TS_enter_underline_mode; /* "ue" -- end underlining. */
const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
const char *TS_exit_underline_mode; /* "us" -- start underlining. */
const char *TS_enter_underline_mode; /* "ue" -- end underlining. */
/* "as"/"ae" -- start/end alternate character set. Not really
supported, yet. */
char *TS_enter_alt_charset_mode;
char *TS_exit_alt_charset_mode;
const char *TS_enter_alt_charset_mode;
const char *TS_exit_alt_charset_mode;
char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */
const char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */
/* Value of the "NC" (no_color_video) capability, or 0 if not present. */
int TN_no_color_video;
......@@ -147,12 +147,12 @@ struct tty_display_info
int TN_max_pairs;
/* "op" -- SVr4 set default pair to its original value. */
char *TS_orig_pair;
const char *TS_orig_pair;
/* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
1 param, the color index. */
char *TS_set_foreground;
char *TS_set_background;
const char *TS_set_foreground;
const char *TS_set_background;
int TF_hazeltine; /* termcap hz flag. */
int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */
......@@ -210,4 +210,3 @@ extern struct tty_display_info *tty_list;
: (abort(), (struct tty_display_info *) 0))
#define CURTTY() FRAME_TTY (SELECTED_FRAME())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment