diff options
| author | Dan Nicolaescu | 2010-09-26 18:06:21 +0300 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-09-26 18:06:21 +0300 |
| commit | dce4c2ac896da32ead5d8a2fcadb428310c104ea (patch) | |
| tree | feb7bc9e2bc348b4052de90670ab938e7ec70d83 | |
| parent | 2696d88f195c0888432f03fb455fdcf273c295c2 (diff) | |
| download | emacs-dce4c2ac896da32ead5d8a2fcadb428310c104ea.tar.gz emacs-dce4c2ac896da32ead5d8a2fcadb428310c104ea.zip | |
Code simplification in term.c.
* src/term.c: Do not include sys/ioctl.h, not needed.
(init_tty): Reorder code to reduce the number of #ifdefs. No code
changes.
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/term.c | 144 |
2 files changed, 73 insertions, 77 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e6bf911952e..3b80698932c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-09-26 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * term.c: Do not include sys/ioctl.h, not needed. | ||
| 4 | (init_tty): Reorder code to reduce the number of #ifdefs. No code | ||
| 5 | changes. | ||
| 6 | |||
| 1 | 2010-09-26 Teodor Zlatanov <tzz@lifelogs.com> | 7 | 2010-09-26 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 8 | ||
| 3 | * process.h: Set up GnuTLS support. | 9 | * process.h: Set up GnuTLS support. |
diff --git a/src/term.c b/src/term.c index 1b4484470e0..934d1b9cf72 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -31,10 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #include <unistd.h> | 31 | #include <unistd.h> |
| 32 | #endif | 32 | #endif |
| 33 | 33 | ||
| 34 | #ifdef HAVE_SYS_IOCTL_H | ||
| 35 | #include <sys/ioctl.h> | ||
| 36 | #endif | ||
| 37 | |||
| 38 | #include <signal.h> | 34 | #include <signal.h> |
| 39 | #include <stdarg.h> | 35 | #include <stdarg.h> |
| 40 | #include <setjmp.h> | 36 | #include <setjmp.h> |
| @@ -3407,6 +3403,15 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3407 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); | 3403 | tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); |
| 3408 | Wcm_clear (tty); | 3404 | Wcm_clear (tty); |
| 3409 | 3405 | ||
| 3406 | encode_terminal_src_size = 0; | ||
| 3407 | encode_terminal_dst_size = 0; | ||
| 3408 | |||
| 3409 | #ifdef HAVE_GPM | ||
| 3410 | terminal->mouse_position_hook = term_mouse_position; | ||
| 3411 | mouse_face_window = Qnil; | ||
| 3412 | #endif | ||
| 3413 | |||
| 3414 | |||
| 3410 | #ifndef DOS_NT | 3415 | #ifndef DOS_NT |
| 3411 | set_tty_hooks (terminal); | 3416 | set_tty_hooks (terminal); |
| 3412 | 3417 | ||
| @@ -3460,78 +3465,6 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3460 | 3465 | ||
| 3461 | add_keyboard_wait_descriptor (fileno (tty->input)); | 3466 | add_keyboard_wait_descriptor (fileno (tty->input)); |
| 3462 | 3467 | ||
| 3463 | #endif /* !DOS_NT */ | ||
| 3464 | |||
| 3465 | encode_terminal_src_size = 0; | ||
| 3466 | encode_terminal_dst_size = 0; | ||
| 3467 | |||
| 3468 | #ifdef HAVE_GPM | ||
| 3469 | terminal->mouse_position_hook = term_mouse_position; | ||
| 3470 | mouse_face_window = Qnil; | ||
| 3471 | #endif | ||
| 3472 | |||
| 3473 | #ifdef DOS_NT | ||
| 3474 | #ifdef WINDOWSNT | ||
| 3475 | initialize_w32_display (terminal); | ||
| 3476 | #else /* MSDOS */ | ||
| 3477 | if (strcmp (terminal_type, "internal") == 0) | ||
| 3478 | terminal->type = output_msdos_raw; | ||
| 3479 | initialize_msdos_display (terminal); | ||
| 3480 | #endif /* MSDOS */ | ||
| 3481 | tty->output = stdout; | ||
| 3482 | tty->input = stdin; | ||
| 3483 | /* The following two are inaccessible from w32console.c. */ | ||
| 3484 | terminal->delete_frame_hook = &tty_free_frame_resources; | ||
| 3485 | terminal->delete_terminal_hook = &delete_tty; | ||
| 3486 | |||
| 3487 | tty->name = xstrdup (name); | ||
| 3488 | terminal->name = xstrdup (name); | ||
| 3489 | tty->type = xstrdup (terminal_type); | ||
| 3490 | |||
| 3491 | add_keyboard_wait_descriptor (0); | ||
| 3492 | |||
| 3493 | Wcm_clear (tty); | ||
| 3494 | |||
| 3495 | #ifdef WINDOWSNT | ||
| 3496 | { | ||
| 3497 | struct frame *f = XFRAME (selected_frame); | ||
| 3498 | |||
| 3499 | FrameRows (tty) = FRAME_LINES (f); | ||
| 3500 | FrameCols (tty) = FRAME_COLS (f); | ||
| 3501 | tty->specified_window = FRAME_LINES (f); | ||
| 3502 | |||
| 3503 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | ||
| 3504 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; | ||
| 3505 | } | ||
| 3506 | #else /* MSDOS */ | ||
| 3507 | { | ||
| 3508 | int height, width; | ||
| 3509 | get_tty_size (fileno (tty->input), &width, &height); | ||
| 3510 | FrameCols (tty) = width; | ||
| 3511 | FrameRows (tty) = height; | ||
| 3512 | } | ||
| 3513 | #endif /* MSDOS */ | ||
| 3514 | tty->delete_in_insert_mode = 1; | ||
| 3515 | |||
| 3516 | UseTabs (tty) = 0; | ||
| 3517 | terminal->scroll_region_ok = 0; | ||
| 3518 | |||
| 3519 | /* Seems to insert lines when it's not supposed to, messing up the | ||
| 3520 | display. In doing a trace, it didn't seem to be called much, so I | ||
| 3521 | don't think we're losing anything by turning it off. */ | ||
| 3522 | terminal->line_ins_del_ok = 0; | ||
| 3523 | #ifdef WINDOWSNT | ||
| 3524 | terminal->char_ins_del_ok = 1; | ||
| 3525 | baud_rate = 19200; | ||
| 3526 | #else /* MSDOS */ | ||
| 3527 | terminal->char_ins_del_ok = 0; | ||
| 3528 | init_baud_rate (fileno (tty->input)); | ||
| 3529 | #endif /* MSDOS */ | ||
| 3530 | |||
| 3531 | tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ | ||
| 3532 | |||
| 3533 | #else /* not DOS_NT */ | ||
| 3534 | |||
| 3535 | Wcm_clear (tty); | 3468 | Wcm_clear (tty); |
| 3536 | 3469 | ||
| 3537 | tty->termcap_term_buffer = (char *) xmalloc (buffer_size); | 3470 | tty->termcap_term_buffer = (char *) xmalloc (buffer_size); |
| @@ -3683,7 +3616,64 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ | |||
| 3683 | tty->TF_underscore = tgetflag ("ul"); | 3616 | tty->TF_underscore = tgetflag ("ul"); |
| 3684 | tty->TF_teleray = tgetflag ("xt"); | 3617 | tty->TF_teleray = tgetflag ("xt"); |
| 3685 | 3618 | ||
| 3686 | #endif /* !DOS_NT */ | 3619 | #else /* DOS_NT */ |
| 3620 | #ifdef WINDOWSNT | ||
| 3621 | { | ||
| 3622 | struct frame *f = XFRAME (selected_frame); | ||
| 3623 | |||
| 3624 | initialize_w32_display (terminal); | ||
| 3625 | |||
| 3626 | FrameRows (tty) = FRAME_LINES (f); | ||
| 3627 | FrameCols (tty) = FRAME_COLS (f); | ||
| 3628 | tty->specified_window = FRAME_LINES (f); | ||
| 3629 | |||
| 3630 | FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; | ||
| 3631 | FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; | ||
| 3632 | terminal->char_ins_del_ok = 1; | ||
| 3633 | baud_rate = 19200; | ||
| 3634 | } | ||
| 3635 | #else /* MSDOS */ | ||
| 3636 | { | ||
| 3637 | int height, width; | ||
| 3638 | if (strcmp (terminal_type, "internal") == 0) | ||
| 3639 | terminal->type = output_msdos_raw; | ||
| 3640 | initialize_msdos_display (terminal); | ||
| 3641 | |||
| 3642 | get_tty_size (fileno (tty->input), &width, &height); | ||
| 3643 | FrameCols (tty) = width; | ||
| 3644 | FrameRows (tty) = height; | ||
| 3645 | terminal->char_ins_del_ok = 0; | ||
| 3646 | init_baud_rate (fileno (tty->input)); | ||
| 3647 | } | ||
| 3648 | #endif /* MSDOS */ | ||
| 3649 | tty->output = stdout; | ||
| 3650 | tty->input = stdin; | ||
| 3651 | /* The following two are inaccessible from w32console.c. */ | ||
| 3652 | terminal->delete_frame_hook = &tty_free_frame_resources; | ||
| 3653 | terminal->delete_terminal_hook = &delete_tty; | ||
| 3654 | |||
| 3655 | tty->name = xstrdup (name); | ||
| 3656 | terminal->name = xstrdup (name); | ||
| 3657 | tty->type = xstrdup (terminal_type); | ||
| 3658 | |||
| 3659 | add_keyboard_wait_descriptor (0); | ||
| 3660 | |||
| 3661 | /* FIXME: this should be removed, done earlier. */ | ||
| 3662 | Wcm_clear (tty); | ||
| 3663 | |||
| 3664 | tty->delete_in_insert_mode = 1; | ||
| 3665 | |||
| 3666 | UseTabs (tty) = 0; | ||
| 3667 | terminal->scroll_region_ok = 0; | ||
| 3668 | |||
| 3669 | /* Seems to insert lines when it's not supposed to, messing up the | ||
| 3670 | display. In doing a trace, it didn't seem to be called much, so I | ||
| 3671 | don't think we're losing anything by turning it off. */ | ||
| 3672 | terminal->line_ins_del_ok = 0; | ||
| 3673 | |||
| 3674 | tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ | ||
| 3675 | #endif /* DOS_NT */ | ||
| 3676 | |||
| 3687 | terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); | 3677 | terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); |
| 3688 | init_kboard (terminal->kboard); | 3678 | init_kboard (terminal->kboard); |
| 3689 | terminal->kboard->Vwindow_system = Qnil; | 3679 | terminal->kboard->Vwindow_system = Qnil; |