From 72abad34056c26fce75f8ece4b66ce386f2d0725 Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 09:30:15 -0800
Subject: * term.c (encode_terminal_code): Now static.
---
src/term.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index f082bb40e89..873ffaba299 100644
--- a/src/term.c
+++ b/src/term.c
@@ -512,7 +512,7 @@ static int encode_terminal_dst_size;
Set CODING->produced to the byte-length of the resulting byte
sequence, and return a pointer to that byte sequence. */
-unsigned char *
+static unsigned char *
encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding)
{
struct glyph *src_end = src + src_len;
--
cgit v1.2.1
From 75f8807fe6cc437f58845ec21621614d1dbb7f36 Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 09:31:51 -0800
Subject: * term.c (encode_terminal_code): Remove unused local
---
src/term.c | 2 --
1 file changed, 2 deletions(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index 873ffaba299..80db7fbeb17 100644
--- a/src/term.c
+++ b/src/term.c
@@ -664,8 +664,6 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
}
else
{
- unsigned char *p = SDATA (string);
-
if (! STRING_MULTIBYTE (string))
string = string_to_multibyte (string);
nbytes = buf - encode_terminal_src;
--
cgit v1.2.1
From 50938595880fd87c7dcd39a607cba1b0a7598baf Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 10:26:34 -0800
Subject: * tparam.h: New file.
* term.c, tparam.h: Include it.
* deps.mk (term.o, tparam.o): Depend on tparam.h.
* term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
Move these decls to tparam.h, and make them agree with what
is actually in tparam.c. The previous trick of using incompatible
decls in different modules does not conform to the C standard.
All callers of tparam changed to use tparam's actual API.
* tparam.c (tparam1, tparam, tgoto):
Use const pointers where appropriate.
---
src/term.c | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index 80db7fbeb17..19d7d893069 100644
--- a/src/term.c
+++ b/src/term.c
@@ -32,6 +32,7 @@ along with GNU Emacs. If not, see . */
#include "lisp.h"
#include "termchar.h"
#include "termopts.h"
+#include "tparam.h"
#include "buffer.h"
#include "character.h"
#include "charset.h"
@@ -53,18 +54,6 @@ along with GNU Emacs. If not, see . */
static int been_here = -1;
#endif
-/* For now, don't try to include termcap.h. On some systems,
- configure finds a non-standard termcap.h that the main build
- won't find. */
-extern void tputs (const char *, int, int (*)(int));
-extern int tgetent (char *, const char *);
-extern int tgetflag (char *id);
-extern int tgetnum (char *id);
-
-char *tparam (char *, char *, int, int, ...);
-
-extern char *tgetstr (char *, char **);
-
#include "cm.h"
#ifdef HAVE_X_WINDOWS
#include "xterm.h"
@@ -262,7 +251,7 @@ tty_set_scroll_region (struct frame *f, int start, int stop)
struct tty_display_info *tty = FRAME_TTY (f);
if (tty->TS_set_scroll_region)
- buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1);
+ buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0);
else if (tty->TS_set_scroll_region_1)
buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
FRAME_LINES (f), start,
@@ -859,7 +848,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
if (tty->TS_ins_multi_chars)
{
- buf = tparam (tty->TS_ins_multi_chars, 0, 0, len);
+ buf = tparam (tty->TS_ins_multi_chars, 0, 0, len, 0, 0, 0);
OUTPUT1 (tty, buf);
xfree (buf);
if (start)
@@ -955,7 +944,7 @@ tty_delete_glyphs (struct frame *f, int n)
if (tty->TS_del_multi_chars)
{
- buf = tparam (tty->TS_del_multi_chars, 0, 0, n);
+ buf = tparam (tty->TS_del_multi_chars, 0, 0, n, 0, 0, 0);
OUTPUT1 (tty, buf);
xfree (buf);
}
@@ -997,7 +986,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
{
raw_cursor_to (f, vpos, 0);
tty_background_highlight (tty);
- buf = tparam (multi, 0, 0, i);
+ buf = tparam (multi, 0, 0, i, 0, 0, 0);
OUTPUT (tty, buf);
xfree (buf);
}
@@ -2125,7 +2114,7 @@ turn_on_face (struct frame *f, int face_id)
ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
if (fg >= 0 && ts)
{
- p = tparam (ts, NULL, 0, (int) fg);
+ p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0);
OUTPUT (tty, p);
xfree (p);
}
@@ -2133,7 +2122,7 @@ turn_on_face (struct frame *f, int face_id)
ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background;
if (bg >= 0 && ts)
{
- p = tparam (ts, NULL, 0, (int) bg);
+ p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0);
OUTPUT (tty, p);
xfree (p);
}
--
cgit v1.2.1
From fbceeba21b3b5aeb2a0f98d4ca937cabbe07fab0 Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 18:12:00 -0800
Subject: * 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.
---
src/term.c | 51 +++++++++++++++++++++++++++++++++------------------
1 file changed, 33 insertions(+), 18 deletions(-)
(limited to 'src/term.c')
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
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 */
--
cgit v1.2.1
From 7f3f1250d4f74203c828e7ba03b721b1f269a0d7 Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 18:15:18 -0800
Subject: * term.c (term_mouse_position): Rename local to avoid shadowing.
---
src/term.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index 6986cfb9e03..9531cce5f9f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2700,14 +2700,14 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
Set *bar_window to Qnil, and *x and *y to the column and
row of the character cell the mouse is over.
- Set *time to the time the mouse was at the returned position.
+ Set *timeptr to the time the mouse was at the returned position.
This clears mouse_moved until the next motion
event arrives. */
static void
term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
enum scroll_bar_part *part, Lisp_Object *x,
- Lisp_Object *y, unsigned long *time)
+ Lisp_Object *y, unsigned long *timeptr)
{
struct timeval now;
@@ -2720,7 +2720,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
XSETINT (*x, last_mouse_x);
XSETINT (*y, last_mouse_y);
gettimeofday(&now, 0);
- *time = (now.tv_sec * 1000) + (now.tv_usec / 1000);
+ *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000);
}
/* Prepare a mouse-event in *RESULT for placement in the input queue.
--
cgit v1.2.1
From b024a9466a0e238e053d0464f4a4f9b19d04648b Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 21:46:35 -0800
Subject: * term.c, tparam.h (tgetflag, tgetnum, tgetstr): Move the const to
the .h file
---
src/term.c | 12 ------------
1 file changed, 12 deletions(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index 9531cce5f9f..e9e880a0c7f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1306,18 +1306,6 @@ 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. */
--
cgit v1.2.1
From c2ed9c8b0cf694c20eea63f31b7c276efa6a1008 Mon Sep 17 00:00:00 2001
From: Paul Eggert
Date: Tue, 8 Mar 2011 22:21:25 -0800
Subject: * term.c (encode_terminal_code): Mark vars for gcc -Wuninitialized.
---
src/term.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index e9e880a0c7f..e78e2e68814 100644
--- a/src/term.c
+++ b/src/term.c
@@ -533,8 +533,8 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
{
if (src->type == COMPOSITE_GLYPH)
{
- struct composition *cmp;
- Lisp_Object gstring;
+ struct composition *cmp IF_LINT (= NULL);
+ Lisp_Object gstring IF_LINT (= Qnil);
int i;
nbytes = buf - encode_terminal_src;
@@ -595,7 +595,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
else if (! CHAR_GLYPH_PADDING_P (*src))
{
GLYPH g;
- int c;
+ int c IF_LINT (= 0);
Lisp_Object string;
string = Qnil;
--
cgit v1.2.1
From 7ef4b50c04d80cbc2b247f997e9133fbce70be05 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii
Date: Fri, 11 Mar 2011 11:41:56 +0200
Subject: Fix MS-Windows build broken by
2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
src/term.c (encode_terminal_code): Now external again, used by
w32console.c and msdos.c.
src/termhooks.h (encode_terminal_code): Declare prototype.
src/msdos.c (encode_terminal_code): Don't declare prototype.
src/makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend
on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
---
src/term.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/term.c')
diff --git a/src/term.c b/src/term.c
index e78e2e68814..e84bbe125f8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -501,7 +501,7 @@ static int encode_terminal_dst_size;
Set CODING->produced to the byte-length of the resulting byte
sequence, and return a pointer to that byte sequence. */
-static unsigned char *
+unsigned char *
encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding)
{
struct glyph *src_end = src + src_len;
--
cgit v1.2.1