summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 @@
* term.c (encode_terminal_code): Now static. Remove unused local.
+ * 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.
+
2011-03-06 Chong Yidong <cyd@stupidchicken.com>
* 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 \
term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \
cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \
xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \
- systty.h syssignal.h $(INTERVALS_H) buffer.h ../lib/unistd.h
+ systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h
termcap.o: termcap.c lisp.h $(config_h)
terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \
msdos.h
terminfo.o: terminfo.c lisp.h globals.h $(config_h)
-tparam.o: tparam.c lisp.h $(config_h)
+tparam.o: tparam.c tparam.h lisp.h $(config_h)
undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \
lisp.h globals.h $(config_h)
unexaix.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/>. */
#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 <http://www.gnu.org/licenses/>. */
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);
}
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. */
#include <config.h>
#include <setjmp.h>
#include "lisp.h" /* for xmalloc */
+#include "tparam.h"
#ifndef NULL
#define NULL (char *) 0
@@ -38,11 +39,12 @@ Boston, MA 02110-1301, USA. */
The fourth and following args to tparam serve as the parameter values. */
-static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp);
+static char *tparam1 (char const *string, char *outstring, int len,
+ char *up, char *left, int *argp);
-/* VARARGS 2 */
char *
-tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3)
+tparam (const char *string, char *outstring, int len,
+ int arg0, int arg1, int arg2, int arg3)
{
int arg[4];
@@ -59,7 +61,7 @@ char *UP;
static char tgoto_buf[50];
char *
-tgoto (char *cm, int hpos, int vpos)
+tgoto (const char *cm, int hpos, int vpos)
{
int args[2];
if (!cm)
@@ -70,10 +72,11 @@ tgoto (char *cm, int hpos, int vpos)
}
static char *
-tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp)
+tparam1 (const char *string, char *outstring, int len,
+ char *up, char *left, register int *argp)
{
register int c;
- register char *p = string;
+ register const char *p = string;
register char *op = outstring;
char *outend;
int outlen = 0;
@@ -277,4 +280,3 @@ main (argc, argv)
}
#endif /* DEBUG */
-
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 @@
+/* Interface definitions for termcap entries.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
+
+
+/* Don't try to include termcap.h. On some systems, configure finds a
+ non-standard termcap.h that the main build won't find. */
+
+void tputs (const char *, int, int (*) (int));
+int tgetent (char *, const char *);
+int tgetflag (char *id);
+int tgetnum (char *id);
+char *tgetstr (char *, char **);
+char *tgoto (const char *, int, int);
+
+char *tparam (const char *, char *, int, int, int, int, int);