aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2008-08-26 20:28:20 +0000
committerEli Zaretskii2008-08-26 20:28:20 +0000
commit2306a735e781d9afc577af06d7cb0b001ee86bc1 (patch)
treec13f4a05a869fd2cb7d70a7c317517ab53336940 /src
parentd0acbbaf39f91d98f84b7013f6cbd957efbe8e91 (diff)
downloademacs-2306a735e781d9afc577af06d7cb0b001ee86bc1.tar.gz
emacs-2306a735e781d9afc577af06d7cb0b001ee86bc1.zip
(internal_terminal_init): Most initializations done only once, especially
initial_screen_colors[] and termscript open.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/msdos.c131
2 files changed, 74 insertions, 62 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ebf5013822b..efde56394c8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12008-08-26 Eli Zaretskii <eliz@gnu.org>
2
3 * msdos.c (internal_terminal_init): Most initializations done only
4 once, especially initial_screen_colors[] and termscript open.
5
12008-08-26 Chong Yidong <cyd@stupidchicken.com> 62008-08-26 Chong Yidong <cyd@stupidchicken.com>
2 7
3 * eval.c (Fcondition_case): Doc fix. 8 * eval.c (Fcondition_case): Doc fix.
diff --git a/src/msdos.c b/src/msdos.c
index 2b049a32ac1..ebbf2cd41e4 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -2414,6 +2414,7 @@ extern void init_frame_faces (FRAME_PTR);
2414void 2414void
2415internal_terminal_init () 2415internal_terminal_init ()
2416{ 2416{
2417 static int init_needed = 1;
2417 char *term = getenv ("TERM"), *colors; 2418 char *term = getenv ("TERM"), *colors;
2418 struct frame *sf = SELECTED_FRAME(); 2419 struct frame *sf = SELECTED_FRAME();
2419 struct tty_display_info *tty; 2420 struct tty_display_info *tty;
@@ -2438,76 +2439,82 @@ internal_terminal_init ()
2438 } 2439 }
2439 2440
2440 tty = FRAME_TTY (sf); 2441 tty = FRAME_TTY (sf);
2441 if (!tty->termscript && getenv ("EMACSTEST")) 2442 if (init_needed)
2442 tty->termscript = fopen (getenv ("EMACSTEST"), "wt");
2443 if (tty->termscript)
2444 { 2443 {
2445 time_t now = time (NULL); 2444 if (!tty->termscript && getenv ("EMACSTEST"))
2446 struct tm *tnow = localtime (&now); 2445 tty->termscript = fopen (getenv ("EMACSTEST"), "wt");
2447 char tbuf[100]; 2446 if (tty->termscript)
2447 {
2448 time_t now = time (NULL);
2449 struct tm *tnow = localtime (&now);
2450 char tbuf[100];
2448 2451
2449 strftime (tbuf, sizeof (tbuf) - 1, "%a %b %e %Y %H:%M:%S %Z", tnow); 2452 strftime (tbuf, sizeof (tbuf) - 1, "%a %b %e %Y %H:%M:%S %Z", tnow);
2450 fprintf (tty->termscript, "\nEmacs session started at %s\n", tbuf); 2453 fprintf (tty->termscript, "\nEmacs session started at %s\n", tbuf);
2451 fprintf (tty->termscript, "=====================\n\n"); 2454 fprintf (tty->termscript, "=====================\n\n");
2452 } 2455 }
2453 2456
2454 Vinitial_window_system = current_kboard->Vwindow_system = Qpc; 2457 Vinitial_window_system = Qpc;
2455 Vwindow_system_version = make_number (23); /* RE Emacs version */ 2458 Vwindow_system_version = make_number (23); /* RE Emacs version */
2456 sf->output_method = output_msdos_raw; 2459 tty->terminal->type = output_msdos_raw;
2457 tty->terminal->type = output_msdos_raw;
2458 2460
2459 /* If Emacs was dumped on DOS/V machine, forget the stale VRAM address. */ 2461 /* If Emacs was dumped on DOS/V machine, forget the stale VRAM
2460 screen_old_address = 0; 2462 address. */
2463 screen_old_address = 0;
2461 2464
2462 /* Forget the stale screen colors as well. */ 2465 /* Forget the stale screen colors as well. */
2463 initial_screen_colors[0] = initial_screen_colors[1] = -1; 2466 initial_screen_colors[0] = initial_screen_colors[1] = -1;
2464 2467
2465 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = 7; /* White */ 2468 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = 7; /* White */
2466 FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ()) = 0; /* Black */ 2469 FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ()) = 0; /* Black */
2467 bright_bg (); 2470 bright_bg ();
2468 colors = getenv ("EMACSCOLORS"); 2471 colors = getenv ("EMACSCOLORS");
2469 if (colors && strlen (colors) >= 2) 2472 if (colors && strlen (colors) >= 2)
2470 { 2473 {
2471 /* The colors use 4 bits each (we enable bright background). */ 2474 /* The colors use 4 bits each (we enable bright background). */
2472 if (isdigit (colors[0])) 2475 if (isdigit (colors[0]))
2473 colors[0] -= '0'; 2476 colors[0] -= '0';
2474 else if (isxdigit (colors[0])) 2477 else if (isxdigit (colors[0]))
2475 colors[0] -= (isupper (colors[0]) ? 'A' : 'a') - 10; 2478 colors[0] -= (isupper (colors[0]) ? 'A' : 'a') - 10;
2476 if (colors[0] >= 0 && colors[0] < 16) 2479 if (colors[0] >= 0 && colors[0] < 16)
2477 FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ()) = colors[0]; 2480 FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ()) = colors[0];
2478 if (isdigit (colors[1])) 2481 if (isdigit (colors[1]))
2479 colors[1] -= '0'; 2482 colors[1] -= '0';
2480 else if (isxdigit (colors[1])) 2483 else if (isxdigit (colors[1]))
2481 colors[1] -= (isupper (colors[1]) ? 'A' : 'a') - 10; 2484 colors[1] -= (isupper (colors[1]) ? 'A' : 'a') - 10;
2482 if (colors[1] >= 0 && colors[1] < 16) 2485 if (colors[1] >= 0 && colors[1] < 16)
2483 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; 2486 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
2484 } 2487 }
2485 the_only_display_info.mouse_face_mouse_frame = NULL; 2488 the_only_display_info.mouse_face_mouse_frame = NULL;
2486 the_only_display_info.mouse_face_deferred_gc = 0; 2489 the_only_display_info.mouse_face_deferred_gc = 0;
2487 the_only_display_info.mouse_face_beg_row = 2490 the_only_display_info.mouse_face_beg_row =
2488 the_only_display_info.mouse_face_beg_col = -1; 2491 the_only_display_info.mouse_face_beg_col = -1;
2489 the_only_display_info.mouse_face_end_row = 2492 the_only_display_info.mouse_face_end_row =
2490 the_only_display_info.mouse_face_end_col = -1; 2493 the_only_display_info.mouse_face_end_col = -1;
2491 the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID; 2494 the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID;
2492 the_only_display_info.mouse_face_window = Qnil; 2495 the_only_display_info.mouse_face_window = Qnil;
2493 the_only_display_info.mouse_face_mouse_x = 2496 the_only_display_info.mouse_face_mouse_x =
2494 the_only_display_info.mouse_face_mouse_y = 0; 2497 the_only_display_info.mouse_face_mouse_y = 0;
2495 the_only_display_info.mouse_face_defer = 0; 2498 the_only_display_info.mouse_face_defer = 0;
2496 the_only_display_info.mouse_face_hidden = 0; 2499 the_only_display_info.mouse_face_hidden = 0;
2497 2500
2498 if (have_mouse) /* detected in dos_ttraw, which see */ 2501 if (have_mouse) /* detected in dos_ttraw, which see */
2499 { 2502 {
2500 have_mouse = 1; /* enable mouse */ 2503 have_mouse = 1; /* enable mouse */
2501 mouse_visible = 0; 2504 mouse_visible = 0;
2502 mouse_setup_buttons (mouse_button_count); 2505 mouse_setup_buttons (mouse_button_count);
2503 tty->terminal->mouse_position_hook = &mouse_get_pos; 2506 tty->terminal->mouse_position_hook = &mouse_get_pos;
2504 mouse_init (); 2507 mouse_init ();
2505 } 2508 }
2506 2509
2507 if (tty->termscript && screen_size) 2510 if (tty->termscript && screen_size)
2508 fprintf (tty->termscript, "<SCREEN SAVED (dimensions=%dx%d)>\n", 2511 fprintf (tty->termscript, "<SCREEN SAVED (dimensions=%dx%d)>\n",
2509 screen_size_X, screen_size_Y); 2512 screen_size_X, screen_size_Y);
2510 2513
2514 init_needed = 0;
2515 }
2516 current_kboard->Vwindow_system = Qpc;
2517 sf->output_method = output_msdos_raw;
2511 init_frame_faces (sf); 2518 init_frame_faces (sf);
2512#endif 2519#endif
2513} 2520}