aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-03-08 10:26:34 -0800
committerPaul Eggert2011-03-08 10:26:34 -0800
commit50938595880fd87c7dcd39a607cba1b0a7598baf (patch)
treee505cffa90ab1c25e1f15c931e6e47c7575b4e2d /src
parent75f8807fe6cc437f58845ec21621614d1dbb7f36 (diff)
downloademacs-50938595880fd87c7dcd39a607cba1b0a7598baf.tar.gz
emacs-50938595880fd87c7dcd39a607cba1b0a7598baf.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/deps.mk4
-rw-r--r--src/term.c25
-rw-r--r--src/tparam.c16
-rw-r--r--src/tparam.h31
5 files changed, 60 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 107d7d663da..350f01953d4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -87,6 +87,17 @@
87 87
88 * term.c (encode_terminal_code): Now static. Remove unused local. 88 * term.c (encode_terminal_code): Now static. Remove unused local.
89 89
90 * tparam.h: New file.
91 * term.c, tparam.h: Include it.
92 * deps.mk (term.o, tparam.o): Depend on tparam.h.
93 * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
94 Move these decls to tparam.h, and make them agree with what
95 is actually in tparam.c. The previous trick of using incompatible
96 decls in different modules does not conform to the C standard.
97 All callers of tparam changed to use tparam's actual API.
98 * tparam.c (tparam1, tparam, tgoto):
99 Use const pointers where appropriate.
100
902011-03-06 Chong Yidong <cyd@stupidchicken.com> 1012011-03-06 Chong Yidong <cyd@stupidchicken.com>
91 102
92 * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06 103 * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06
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/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 <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,
@@ -859,7 +848,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
859 848
860 if (tty->TS_ins_multi_chars) 849 if (tty->TS_ins_multi_chars)
861 { 850 {
862 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len); 851 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len, 0, 0, 0);
863 OUTPUT1 (tty, buf); 852 OUTPUT1 (tty, buf);
864 xfree (buf); 853 xfree (buf);
865 if (start) 854 if (start)
@@ -955,7 +944,7 @@ tty_delete_glyphs (struct frame *f, int n)
955 944
956 if (tty->TS_del_multi_chars) 945 if (tty->TS_del_multi_chars)
957 { 946 {
958 buf = tparam (tty->TS_del_multi_chars, 0, 0, n); 947 buf = tparam (tty->TS_del_multi_chars, 0, 0, n, 0, 0, 0);
959 OUTPUT1 (tty, buf); 948 OUTPUT1 (tty, buf);
960 xfree (buf); 949 xfree (buf);
961 } 950 }
@@ -997,7 +986,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
997 { 986 {
998 raw_cursor_to (f, vpos, 0); 987 raw_cursor_to (f, vpos, 0);
999 tty_background_highlight (tty); 988 tty_background_highlight (tty);
1000 buf = tparam (multi, 0, 0, i); 989 buf = tparam (multi, 0, 0, i, 0, 0, 0);
1001 OUTPUT (tty, buf); 990 OUTPUT (tty, buf);
1002 xfree (buf); 991 xfree (buf);
1003 } 992 }
@@ -2125,7 +2114,7 @@ turn_on_face (struct frame *f, int face_id)
2125 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; 2114 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
2126 if (fg >= 0 && ts) 2115 if (fg >= 0 && ts)
2127 { 2116 {
2128 p = tparam (ts, NULL, 0, (int) fg); 2117 p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0);
2129 OUTPUT (tty, p); 2118 OUTPUT (tty, p);
2130 xfree (p); 2119 xfree (p);
2131 } 2120 }
@@ -2133,7 +2122,7 @@ turn_on_face (struct frame *f, int face_id)
2133 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; 2122 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background;
2134 if (bg >= 0 && ts) 2123 if (bg >= 0 && ts)
2135 { 2124 {
2136 p = tparam (ts, NULL, 0, (int) bg); 2125 p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0);
2137 OUTPUT (tty, p); 2126 OUTPUT (tty, p);
2138 xfree (p); 2127 xfree (p);
2139 } 2128 }
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..11c9ae68aad
--- /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 (char *id);
27int tgetnum (char *id);
28char *tgetstr (char *, char **);
29char *tgoto (const char *, int, int);
30
31char *tparam (const char *, char *, int, int, int, int, int);