diff options
| author | Stefan Monnier | 2010-08-11 07:42:48 +0200 |
|---|---|---|
| committer | Stefan Monnier | 2010-08-11 07:42:48 +0200 |
| commit | c566235d981eba73c88bbff00b6a1d88360b6e9f (patch) | |
| tree | f8d653add3570fe750a83d1123ed35022e0bf4ef /src/term.c | |
| parent | 0bfdb86f425a88fe43ebc88851c6f9a6418e1862 (diff) | |
| parent | 490b89acab3e759426ede25c31c94268df55e925 (diff) | |
| download | emacs-c566235d981eba73c88bbff00b6a1d88360b6e9f.tar.gz emacs-c566235d981eba73c88bbff00b6a1d88360b6e9f.zip | |
Merge from trunk
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/src/term.c b/src/term.c index 3233db84cf7..4f326234956 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -34,6 +34,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | #if HAVE_TERMIOS_H | 34 | #if HAVE_TERMIOS_H |
| 35 | #include <termios.h> /* For TIOCNOTTY. */ | 35 | #include <termios.h> /* For TIOCNOTTY. */ |
| 36 | #endif | 36 | #endif |
| 37 | #ifdef HAVE_SYS_IOCTL_H | ||
| 38 | #include <sys/ioctl.h> | ||
| 39 | #endif | ||
| 37 | 40 | ||
| 38 | #include <signal.h> | 41 | #include <signal.h> |
| 39 | #include <stdarg.h> | 42 | #include <stdarg.h> |
| @@ -132,8 +135,6 @@ static int visible_cursor; | |||
| 132 | 135 | ||
| 133 | /* Display space properties */ | 136 | /* Display space properties */ |
| 134 | 137 | ||
| 135 | extern Lisp_Object Qspace, QCalign_to, QCwidth; | ||
| 136 | |||
| 137 | /* Functions to call after suspending a tty. */ | 138 | /* Functions to call after suspending a tty. */ |
| 138 | Lisp_Object Vsuspend_tty_functions; | 139 | Lisp_Object Vsuspend_tty_functions; |
| 139 | 140 | ||
| @@ -183,7 +184,7 @@ static int no_controlling_tty; | |||
| 183 | 184 | ||
| 184 | static int system_uses_terminfo; | 185 | static int system_uses_terminfo; |
| 185 | 186 | ||
| 186 | char *tparam (); | 187 | char *tparam (char *, char *, int, int, ...); |
| 187 | 188 | ||
| 188 | extern char *tgetstr (char *, char **); | 189 | extern char *tgetstr (char *, char **); |
| 189 | 190 | ||
| @@ -712,7 +713,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi | |||
| 712 | } | 713 | } |
| 713 | else | 714 | else |
| 714 | { | 715 | { |
| 715 | unsigned char *p = SDATA (string), *pend = p + SBYTES (string); | 716 | unsigned char *p = SDATA (string); |
| 716 | 717 | ||
| 717 | if (! STRING_MULTIBYTE (string)) | 718 | if (! STRING_MULTIBYTE (string)) |
| 718 | string = string_to_multibyte (string); | 719 | string = string_to_multibyte (string); |
| @@ -1086,7 +1087,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n) | |||
| 1086 | not counting any line-dependent padding. */ | 1087 | not counting any line-dependent padding. */ |
| 1087 | 1088 | ||
| 1088 | int | 1089 | int |
| 1089 | string_cost (char *str) | 1090 | string_cost (const char *str) |
| 1090 | { | 1091 | { |
| 1091 | cost = 0; | 1092 | cost = 0; |
| 1092 | if (str) | 1093 | if (str) |
| @@ -1098,7 +1099,7 @@ string_cost (char *str) | |||
| 1098 | counting any line-dependent padding at one line. */ | 1099 | counting any line-dependent padding at one line. */ |
| 1099 | 1100 | ||
| 1100 | static int | 1101 | static int |
| 1101 | string_cost_one_line (char *str) | 1102 | string_cost_one_line (const char *str) |
| 1102 | { | 1103 | { |
| 1103 | cost = 0; | 1104 | cost = 0; |
| 1104 | if (str) | 1105 | if (str) |
| @@ -1110,7 +1111,7 @@ string_cost_one_line (char *str) | |||
| 1110 | in tenths of characters. */ | 1111 | in tenths of characters. */ |
| 1111 | 1112 | ||
| 1112 | int | 1113 | int |
| 1113 | per_line_cost (char *str) | 1114 | per_line_cost (const char *str) |
| 1114 | { | 1115 | { |
| 1115 | cost = 0; | 1116 | cost = 0; |
| 1116 | if (str) | 1117 | if (str) |
| @@ -1121,7 +1122,6 @@ per_line_cost (char *str) | |||
| 1121 | return cost; | 1122 | return cost; |
| 1122 | } | 1123 | } |
| 1123 | 1124 | ||
| 1124 | #ifndef old | ||
| 1125 | /* char_ins_del_cost[n] is cost of inserting N characters. | 1125 | /* char_ins_del_cost[n] is cost of inserting N characters. |
| 1126 | char_ins_del_cost[-n] is cost of deleting N characters. | 1126 | char_ins_del_cost[-n] is cost of deleting N characters. |
| 1127 | The length of this vector is based on max_frame_cols. */ | 1127 | The length of this vector is based on max_frame_cols. */ |
| @@ -1129,7 +1129,6 @@ per_line_cost (char *str) | |||
| 1129 | int *char_ins_del_vector; | 1129 | int *char_ins_del_vector; |
| 1130 | 1130 | ||
| 1131 | #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))]) | 1131 | #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_COLS ((f))]) |
| 1132 | #endif | ||
| 1133 | 1132 | ||
| 1134 | /* ARGSUSED */ | 1133 | /* ARGSUSED */ |
| 1135 | static void | 1134 | static void |
| @@ -1267,7 +1266,7 @@ struct fkey_table { | |||
| 1267 | other keys (as on the IBM PC keyboard) they get overridden. | 1266 | other keys (as on the IBM PC keyboard) they get overridden. |
| 1268 | */ | 1267 | */ |
| 1269 | 1268 | ||
| 1270 | static struct fkey_table keys[] = | 1269 | static const struct fkey_table keys[] = |
| 1271 | { | 1270 | { |
| 1272 | {"kh", "home"}, /* termcap */ | 1271 | {"kh", "home"}, /* termcap */ |
| 1273 | {"kl", "left"}, /* termcap */ | 1272 | {"kl", "left"}, /* termcap */ |
| @@ -1363,6 +1362,7 @@ static struct fkey_table keys[] = | |||
| 1363 | {"!3", "S-undo"} /*shifted undo key*/ | 1362 | {"!3", "S-undo"} /*shifted undo key*/ |
| 1364 | }; | 1363 | }; |
| 1365 | 1364 | ||
| 1365 | #ifndef DOS_NT | ||
| 1366 | static char **term_get_fkeys_address; | 1366 | static char **term_get_fkeys_address; |
| 1367 | static KBOARD *term_get_fkeys_kboard; | 1367 | static KBOARD *term_get_fkeys_kboard; |
| 1368 | static Lisp_Object term_get_fkeys_1 (void); | 1368 | static Lisp_Object term_get_fkeys_1 (void); |
| @@ -1382,7 +1382,6 @@ term_get_fkeys (char **address, KBOARD *kboard) | |||
| 1382 | function key specification, rather than giving the user an error and | 1382 | function key specification, rather than giving the user an error and |
| 1383 | refusing to run at all on such a terminal. */ | 1383 | refusing to run at all on such a terminal. */ |
| 1384 | 1384 | ||
| 1385 | extern Lisp_Object Fidentity (Lisp_Object); | ||
| 1386 | term_get_fkeys_address = address; | 1385 | term_get_fkeys_address = address; |
| 1387 | term_get_fkeys_kboard = kboard; | 1386 | term_get_fkeys_kboard = kboard; |
| 1388 | internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); | 1387 | internal_condition_case (term_get_fkeys_1, Qerror, Fidentity); |
| @@ -1500,20 +1499,12 @@ term_get_fkeys_1 (void) | |||
| 1500 | 1499 | ||
| 1501 | return Qnil; | 1500 | return Qnil; |
| 1502 | } | 1501 | } |
| 1502 | #endif /* not DOS_NT */ | ||
| 1503 | 1503 | ||
| 1504 | 1504 | ||
| 1505 | /*********************************************************************** | 1505 | /*********************************************************************** |
| 1506 | Character Display Information | 1506 | Character Display Information |
| 1507 | ***********************************************************************/ | 1507 | ***********************************************************************/ |
| 1508 | |||
| 1509 | /* Avoid name clash with functions defined in xterm.c */ | ||
| 1510 | #ifdef static | ||
| 1511 | #define append_glyph append_glyph_term | ||
| 1512 | #define produce_stretch_glyph produce_stretch_glyph_term | ||
| 1513 | #define append_composite_glyph append_composite_glyph_term | ||
| 1514 | #define produce_composite_glyph produce_composite_glyph_term | ||
| 1515 | #endif | ||
| 1516 | |||
| 1517 | static void append_glyph (struct it *); | 1508 | static void append_glyph (struct it *); |
| 1518 | static void produce_stretch_glyph (struct it *); | 1509 | static void produce_stretch_glyph (struct it *); |
| 1519 | static void append_composite_glyph (struct it *); | 1510 | static void append_composite_glyph (struct it *); |
| @@ -1858,8 +1849,6 @@ append_composite_glyph (struct it *it) | |||
| 1858 | static void | 1849 | static void |
| 1859 | produce_composite_glyph (struct it *it) | 1850 | produce_composite_glyph (struct it *it) |
| 1860 | { | 1851 | { |
| 1861 | int c; | ||
| 1862 | |||
| 1863 | if (it->cmp_it.ch < 0) | 1852 | if (it->cmp_it.ch < 0) |
| 1864 | { | 1853 | { |
| 1865 | struct composition *cmp = composition_table[it->cmp_it.id]; | 1854 | struct composition *cmp = composition_table[it->cmp_it.id]; |
| @@ -2254,7 +2243,6 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) | |||
| 2254 | Lisp_Object tem, val; | 2243 | Lisp_Object tem, val; |
| 2255 | Lisp_Object color_mode; | 2244 | Lisp_Object color_mode; |
| 2256 | int mode; | 2245 | int mode; |
| 2257 | extern Lisp_Object Qtty_color_mode; | ||
| 2258 | Lisp_Object tty_color_mode_alist | 2246 | Lisp_Object tty_color_mode_alist |
| 2259 | = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil); | 2247 | = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil); |
| 2260 | 2248 | ||
| @@ -2313,7 +2301,7 @@ get_tty_terminal (Lisp_Object terminal, int throw) | |||
| 2313 | Returns NULL if the named terminal device is not opened. */ | 2301 | Returns NULL if the named terminal device is not opened. */ |
| 2314 | 2302 | ||
| 2315 | struct terminal * | 2303 | struct terminal * |
| 2316 | get_named_tty (char *name) | 2304 | get_named_tty (const char *name) |
| 2317 | { | 2305 | { |
| 2318 | struct terminal *t; | 2306 | struct terminal *t; |
| 2319 | 2307 | ||
| @@ -2793,7 +2781,6 @@ term_mouse_highlight (struct frame *f, int x, int y) | |||
| 2793 | 2781 | ||
| 2794 | /* Check for mouse-face. */ | 2782 | /* Check for mouse-face. */ |
| 2795 | { | 2783 | { |
| 2796 | extern Lisp_Object Qmouse_face; | ||
| 2797 | Lisp_Object mouse_face, overlay, position, *overlay_vec; | 2784 | Lisp_Object mouse_face, overlay, position, *overlay_vec; |
| 2798 | int noverlays, obegv, ozv; | 2785 | int noverlays, obegv, ozv; |
| 2799 | struct buffer *obuf; | 2786 | struct buffer *obuf; |
| @@ -2919,7 +2906,6 @@ term_mouse_highlight (struct frame *f, int x, int y) | |||
| 2919 | /* Look for a `help-echo' property. */ | 2906 | /* Look for a `help-echo' property. */ |
| 2920 | { | 2907 | { |
| 2921 | Lisp_Object help; | 2908 | Lisp_Object help; |
| 2922 | extern Lisp_Object Qhelp_echo; | ||
| 2923 | 2909 | ||
| 2924 | /* Check overlays first. */ | 2910 | /* Check overlays first. */ |
| 2925 | help = Qnil; | 2911 | help = Qnil; |
| @@ -3348,7 +3334,7 @@ dissociate_if_controlling_tty (int fd) | |||
| 3348 | EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ | 3334 | EMACS_GET_TTY_PGRP (fd, &pgid); /* If tcgetpgrp succeeds, fd is the ctty. */ |
| 3349 | if (pgid != -1) | 3335 | if (pgid != -1) |
| 3350 | { | 3336 | { |
| 3351 | #if defined (USG) | 3337 | #if defined (USG5) |
| 3352 | setpgrp (); | 3338 | setpgrp (); |
| 3353 | no_controlling_tty = 1; | 3339 | no_controlling_tty = 1; |
| 3354 | #elif defined (CYGWIN) | 3340 | #elif defined (CYGWIN) |
| @@ -3386,7 +3372,7 @@ dissociate_if_controlling_tty (int fd) | |||
| 3386 | If MUST_SUCCEED is true, then all errors are fatal. */ | 3372 | If MUST_SUCCEED is true, then all errors are fatal. */ |
| 3387 | 3373 | ||
| 3388 | struct terminal * | 3374 | struct terminal * |
| 3389 | init_tty (char *name, char *terminal_type, int must_succeed) | 3375 | init_tty (const char *name, const char *terminal_type, int must_succeed) |
| 3390 | { | 3376 | { |
| 3391 | char *area = NULL; | 3377 | char *area = NULL; |
| 3392 | char **address = &area; | 3378 | char **address = &area; |