]> git.eshelyaron.com Git - emacs.git/commitdiff
* tparam.h: New file.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 8 Mar 2011 18:26:34 +0000 (10:26 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 8 Mar 2011 18:26:34 +0000 (10:26 -0800)
* 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/ChangeLog
src/deps.mk
src/term.c
src/tparam.c
src/tparam.h [new file with mode: 0644]

index 107d7d663dab25bd0524434c01328b77f8bfee78..350f01953d4d31ac49391380da1f3a6d3d43befb 100644 (file)
 
        * 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
index 77994bcaadbdc7c7520790b5a893eb949e948f39..2b162b07bb89e55fda5a63d901fae4422fb877bd 100644 (file)
@@ -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)
index 80db7fbeb17923f69095c2c1aeb6e9569063c58c..19d7d8930698b4d1692ed98d610aa481a7e16671 100644 (file)
@@ -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);
        }
index fcbb63881e6e28e82d0ad1910f8736a86e747632..6aae0b97db982cc4ad4159119ae774874e2b7b3b 100644 (file)
@@ -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 (file)
index 0000000..11c9ae6
--- /dev/null
@@ -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);