aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2002-05-17 13:12:37 +0000
committerEli Zaretskii2002-05-17 13:12:37 +0000
commit56e19ec475f94f484f3b63e804f250b9a7e118c6 (patch)
treeb1330c56887216075f6506ffc204be7c7eb20b30 /src
parentb058cb36fe601f7cc1d5604f348442228994abdd (diff)
downloademacs-56e19ec475f94f484f3b63e804f250b9a7e118c6.tar.gz
emacs-56e19ec475f94f484f3b63e804f250b9a7e118c6.zip
Fix whitespace.
(sig_suspender, sigprocmask): Don't define for DJGPP 2.02 and later.
Diffstat (limited to 'src')
-rw-r--r--src/msdos.c218
1 files changed, 89 insertions, 129 deletions
diff --git a/src/msdos.c b/src/msdos.c
index ecaa8a4eda2..4cc3343eb09 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -109,14 +109,14 @@ event_timestamp ()
109{ 109{
110 struct time t; 110 struct time t;
111 unsigned long s; 111 unsigned long s;
112 112
113 gettime (&t); 113 gettime (&t);
114 s = t.ti_min; 114 s = t.ti_min;
115 s *= 60; 115 s *= 60;
116 s += t.ti_sec; 116 s += t.ti_sec;
117 s *= 1000; 117 s *= 1000;
118 s += t.ti_hund * 10; 118 s += t.ti_hund * 10;
119 119
120 return s; 120 return s;
121} 121}
122 122
@@ -439,8 +439,7 @@ dosv_refresh_virtual_screen (int offset, int count)
439 439
440static void 440static void
441dos_direct_output (y, x, buf, len) 441dos_direct_output (y, x, buf, len)
442 int y; 442 int x, y;
443 int x;
444 char *buf; 443 char *buf;
445 int len; 444 int len;
446{ 445{
@@ -568,10 +567,9 @@ dos_set_window_size (rows, cols)
568 int *rows, *cols; 567 int *rows, *cols;
569{ 568{
570 char video_name[30]; 569 char video_name[30];
571 Lisp_Object video_mode;
572 int video_mode_value;
573 int have_vga = 0;
574 union REGS regs; 570 union REGS regs;
571 Lisp_Object video_mode;
572 int video_mode_value, have_vga = 0;
575 int current_rows = ScreenRows (), current_cols = ScreenCols (); 573 int current_rows = ScreenRows (), current_cols = ScreenCols ();
576 574
577 if (*rows == current_rows && *cols == current_cols) 575 if (*rows == current_rows && *cols == current_cols)
@@ -610,8 +608,7 @@ dos_set_window_size (rows, cols)
610 else 608 else
611 { 609 {
612 static struct { 610 static struct {
613 int rows; 611 int rows, need_vga;
614 int need_vga;
615 } std_dimension[] = { 612 } std_dimension[] = {
616 {25, 0}, 613 {25, 0},
617 {28, 1}, 614 {28, 1},
@@ -720,14 +717,14 @@ static void
720mouse_off_maybe () 717mouse_off_maybe ()
721{ 718{
722 int x, y; 719 int x, y;
723 720
724 if (!mouse_visible) 721 if (!mouse_visible)
725 return; 722 return;
726 723
727 mouse_get_xy (&x, &y); 724 mouse_get_xy (&x, &y);
728 if (y != new_pos_Y || x < new_pos_X) 725 if (y != new_pos_Y || x < new_pos_X)
729 return; 726 return;
730 727
731 mouse_off (); 728 mouse_off ();
732} 729}
733 730
@@ -977,7 +974,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
977 int conversion_buffer_size = sizeof conversion_buffer; 974 int conversion_buffer_size = sizeof conversion_buffer;
978 975
979 if (str_len <= 0) return; 976 if (str_len <= 0) return;
980 977
981 screen_buf = screen_bp = alloca (str_len * 2); 978 screen_buf = screen_bp = alloca (str_len * 2);
982 screen_buf_end = screen_buf + str_len * 2; 979 screen_buf_end = screen_buf + str_len * 2;
983 sf = SELECTED_FRAME(); 980 sf = SELECTED_FRAME();
@@ -988,7 +985,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
988 face of the frame, before writing glyphs, and let the glyphs 985 face of the frame, before writing glyphs, and let the glyphs
989 set the right face if it's different from the default. */ 986 set the right face if it's different from the default. */
990 IT_set_face (DEFAULT_FACE_ID); 987 IT_set_face (DEFAULT_FACE_ID);
991 988
992 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at 989 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
993 the tail. */ 990 the tail. */
994 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK; 991 terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
@@ -1227,7 +1224,7 @@ show_mouse_face (struct display_info *dpyinfo, int hl)
1227 int i; 1224 int i;
1228 struct face *fp; 1225 struct face *fp;
1229 1226
1230 1227
1231 /* If window is in the process of being destroyed, don't bother 1228 /* If window is in the process of being destroyed, don't bother
1232 doing anything. */ 1229 doing anything. */
1233 if (w->current_matrix == NULL) 1230 if (w->current_matrix == NULL)
@@ -1337,7 +1334,6 @@ show_mouse_face (struct display_info *dpyinfo, int hl)
1337 } 1334 }
1338 1335
1339 set_cursor_shape: 1336 set_cursor_shape:
1340
1341 /* Change the mouse pointer shape. */ 1337 /* Change the mouse pointer shape. */
1342 IT_set_mouse_pointer (hl); 1338 IT_set_mouse_pointer (hl);
1343} 1339}
@@ -1362,13 +1358,9 @@ clear_mouse_face (struct display_info *dpyinfo)
1362static int 1358static int
1363fast_find_position (struct window *w, int pos, int *hpos, int *vpos) 1359fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
1364{ 1360{
1365 int i; 1361 int i, lastcol, line_start_position, maybe_next_line_p = 0;
1366 int lastcol;
1367 int maybe_next_line_p = 0;
1368 int line_start_position;
1369 int yb = window_text_bottom_y (w); 1362 int yb = window_text_bottom_y (w);
1370 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0); 1363 struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
1371 struct glyph_row *best_row = row;
1372 1364
1373 while (row->y < yb) 1365 while (row->y < yb)
1374 { 1366 {
@@ -1394,10 +1386,10 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
1394 never-never land... */ 1386 never-never land... */
1395 if (row->y + 1 >= yb) 1387 if (row->y + 1 >= yb)
1396 break; 1388 break;
1397 1389
1398 ++row; 1390 ++row;
1399 } 1391 }
1400 1392
1401 /* Find the right column within BEST_ROW. */ 1393 /* Find the right column within BEST_ROW. */
1402 lastcol = 0; 1394 lastcol = 0;
1403 row = best_row; 1395 row = best_row;
@@ -1449,13 +1441,13 @@ IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p)
1449 row = MATRIX_MODE_LINE_ROW (w->current_matrix); 1441 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
1450 else 1442 else
1451 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); 1443 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
1452 1444
1453 if (row->enabled_p) 1445 if (row->enabled_p)
1454 { 1446 {
1455 extern Lisp_Object Qhelp_echo; 1447 extern Lisp_Object Qhelp_echo;
1456 struct glyph *glyph, *end; 1448 struct glyph *glyph, *end;
1457 Lisp_Object help, map; 1449 Lisp_Object help, map;
1458 1450
1459 /* Find the glyph under X. */ 1451 /* Find the glyph under X. */
1460 glyph = row->glyphs[TEXT_AREA] 1452 glyph = row->glyphs[TEXT_AREA]
1461 + x - FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f); 1453 + x - FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);
@@ -1549,10 +1541,9 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1549 && (XFASTINT (w->last_overlay_modified) 1541 && (XFASTINT (w->last_overlay_modified)
1550 == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) 1542 == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))))
1551 { 1543 {
1552 int pos, i; 1544 int pos, i, nrows = w->current_matrix->nrows;
1553 struct glyph_row *row; 1545 struct glyph_row *row;
1554 struct glyph *glyph; 1546 struct glyph *glyph;
1555 int nrows = w->current_matrix->nrows;
1556 1547
1557 /* Find the glyph under X/Y. */ 1548 /* Find the glyph under X/Y. */
1558 glyph = NULL; 1549 glyph = NULL;
@@ -1594,11 +1585,9 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1594 /* Check for mouse-face and help-echo. */ 1585 /* Check for mouse-face and help-echo. */
1595 { 1586 {
1596 extern Lisp_Object Qmouse_face; 1587 extern Lisp_Object Qmouse_face;
1597 Lisp_Object mouse_face, overlay, position; 1588 Lisp_Object mouse_face, overlay, position, *overlay_vec;
1598 Lisp_Object *overlay_vec; 1589 int len, noverlays, obegv, ozv;;
1599 int len, noverlays;
1600 struct buffer *obuf; 1590 struct buffer *obuf;
1601 int obegv, ozv;
1602 1591
1603 /* If we get an out-of-range value, return now; avoid an error. */ 1592 /* If we get an out-of-range value, return now; avoid an error. */
1604 if (pos > BUF_Z (XBUFFER (w->buffer))) 1593 if (pos > BUF_Z (XBUFFER (w->buffer)))
@@ -1629,7 +1618,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1629 noverlays = overlays_at (pos, 1618 noverlays = overlays_at (pos,
1630 0, &overlay_vec, &len, NULL, NULL, 0); 1619 0, &overlay_vec, &len, NULL, NULL, 0);
1631 } 1620 }
1632 1621
1633 /* Sort overlays into increasing priority order. */ 1622 /* Sort overlays into increasing priority order. */
1634 noverlays = sort_overlays (overlay_vec, noverlays, w); 1623 noverlays = sort_overlays (overlay_vec, noverlays, w);
1635 1624
@@ -1737,7 +1726,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1737 overlay = overlay_vec[i]; 1726 overlay = overlay_vec[i];
1738 help = Foverlay_get (overlay, Qhelp_echo); 1727 help = Foverlay_get (overlay, Qhelp_echo);
1739 } 1728 }
1740 1729
1741 if (!NILP (help)) 1730 if (!NILP (help))
1742 { 1731 {
1743 help_echo = help; 1732 help_echo = help;
@@ -1765,7 +1754,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1765 } 1754 }
1766 } 1755 }
1767 } 1756 }
1768 1757
1769 BEGV = obegv; 1758 BEGV = obegv;
1770 ZV = ozv; 1759 ZV = ozv;
1771 current_buffer = obuf; 1760 current_buffer = obuf;
@@ -1777,8 +1766,7 @@ static void
1777IT_clear_end_of_line (int first_unused) 1766IT_clear_end_of_line (int first_unused)
1778{ 1767{
1779 char *spaces, *sp; 1768 char *spaces, *sp;
1780 int i, j; 1769 int i, j, offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
1781 int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
1782 extern int fatal_error_in_progress; 1770 extern int fatal_error_in_progress;
1783 1771
1784 if (new_pos_X >= first_unused || fatal_error_in_progress) 1772 if (new_pos_X >= first_unused || fatal_error_in_progress)
@@ -1789,7 +1777,7 @@ IT_clear_end_of_line (int first_unused)
1789 if (termscript) 1777 if (termscript)
1790 fprintf (termscript, "<CLR:EOL[%d..%d)>", new_pos_X, first_unused); 1778 fprintf (termscript, "<CLR:EOL[%d..%d)>", new_pos_X, first_unused);
1791 spaces = sp = alloca (i); 1779 spaces = sp = alloca (i);
1792 1780
1793 while (--j >= 0) 1781 while (--j >= 0)
1794 { 1782 {
1795 *sp++ = ' '; 1783 *sp++ = ' ';
@@ -2156,14 +2144,14 @@ IT_set_terminal_modes (void)
2156 screen_size_X = ScreenCols (); 2144 screen_size_X = ScreenCols ();
2157 screen_size_Y = ScreenRows (); 2145 screen_size_Y = ScreenRows ();
2158 screen_size = screen_size_X * screen_size_Y; 2146 screen_size = screen_size_X * screen_size_Y;
2159 2147
2160 new_pos_X = new_pos_Y = 0; 2148 new_pos_X = new_pos_Y = 0;
2161 current_pos_X = current_pos_Y = -1; 2149 current_pos_X = current_pos_Y = -1;
2162 2150
2163 if (term_setup_done) 2151 if (term_setup_done)
2164 return; 2152 return;
2165 term_setup_done = 1; 2153 term_setup_done = 1;
2166 2154
2167 startup_screen_size_X = screen_size_X; 2155 startup_screen_size_X = screen_size_X;
2168 startup_screen_size_Y = screen_size_Y; 2156 startup_screen_size_Y = screen_size_Y;
2169 startup_screen_attrib = ScreenAttrib; 2157 startup_screen_attrib = ScreenAttrib;
@@ -2219,19 +2207,17 @@ IT_reset_terminal_modes (void)
2219{ 2207{
2220 int display_row_start = (int) ScreenPrimary; 2208 int display_row_start = (int) ScreenPrimary;
2221 int saved_row_len = startup_screen_size_X * 2; 2209 int saved_row_len = startup_screen_size_X * 2;
2222 int update_row_len = ScreenCols () * 2; 2210 int update_row_len = ScreenCols () * 2, current_rows = ScreenRows ();
2223 int current_rows = ScreenRows ();
2224 int to_next_row = update_row_len; 2211 int to_next_row = update_row_len;
2225 unsigned char *saved_row = startup_screen_buffer; 2212 unsigned char *saved_row = startup_screen_buffer;
2226 int cursor_pos_X = ScreenCols () - 1; 2213 int cursor_pos_X = ScreenCols () - 1, cursor_pos_Y = ScreenRows () - 1;
2227 int cursor_pos_Y = ScreenRows () - 1;
2228 2214
2229 if (termscript) 2215 if (termscript)
2230 fprintf (termscript, "\n<RESET_TERM>"); 2216 fprintf (termscript, "\n<RESET_TERM>");
2231 2217
2232 if (!term_setup_done) 2218 if (!term_setup_done)
2233 return; 2219 return;
2234 2220
2235 mouse_off (); 2221 mouse_off ();
2236 2222
2237 /* Leave the video system in the same state as we found it, 2223 /* Leave the video system in the same state as we found it,
@@ -2331,19 +2317,16 @@ IT_set_frame_parameters (f, alist)
2331 Lisp_Object alist; 2317 Lisp_Object alist;
2332{ 2318{
2333 Lisp_Object tail; 2319 Lisp_Object tail;
2334 int length = XINT (Flength (alist)); 2320 int i, j, length = XINT (Flength (alist));
2335 int i, j;
2336 Lisp_Object *parms 2321 Lisp_Object *parms
2337 = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); 2322 = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
2338 Lisp_Object *values 2323 Lisp_Object *values
2339 = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); 2324 = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
2340 /* Do we have to reverse the foreground and background colors? */ 2325 /* Do we have to reverse the foreground and background colors? */
2341 int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt); 2326 int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt);
2342 int was_reverse = reverse; 2327 int need_to_reverse, was_reverse = reverse;
2343 int redraw = 0, fg_set = 0, bg_set = 0; 2328 int redraw = 0, fg_set = 0, bg_set = 0;
2344 int need_to_reverse; 2329 unsigned long orig_fg, orig_bg;
2345 unsigned long orig_fg;
2346 unsigned long orig_bg;
2347 Lisp_Object frame_bg, frame_fg; 2330 Lisp_Object frame_bg, frame_fg;
2348 extern Lisp_Object Qdefault, QCforeground, QCbackground; 2331 extern Lisp_Object Qdefault, QCforeground, QCbackground;
2349 2332
@@ -2400,8 +2383,7 @@ IT_set_frame_parameters (f, alist)
2400 /* Now process the alist elements in reverse of specified order. */ 2383 /* Now process the alist elements in reverse of specified order. */
2401 for (i--; i >= 0; i--) 2384 for (i--; i >= 0; i--)
2402 { 2385 {
2403 Lisp_Object prop, val; 2386 Lisp_Object prop, val, frame;
2404 Lisp_Object frame;
2405 2387
2406 prop = parms[i]; 2388 prop = parms[i];
2407 val = values[i]; 2389 val = values[i];
@@ -2529,8 +2511,7 @@ extern void init_frame_faces (FRAME_PTR);
2529void 2511void
2530internal_terminal_init () 2512internal_terminal_init ()
2531{ 2513{
2532 char *term = getenv ("TERM"); 2514 char *term = getenv ("TERM"), *colors;
2533 char *colors;
2534 struct frame *sf = SELECTED_FRAME(); 2515 struct frame *sf = SELECTED_FRAME();
2535 2516
2536#ifdef HAVE_X_WINDOWS 2517#ifdef HAVE_X_WINDOWS
@@ -2543,7 +2524,7 @@ internal_terminal_init ()
2543 2524
2544 if (getenv ("EMACSTEST")) 2525 if (getenv ("EMACSTEST"))
2545 termscript = fopen (getenv ("EMACSTEST"), "wt"); 2526 termscript = fopen (getenv ("EMACSTEST"), "wt");
2546 2527
2547#ifndef HAVE_X_WINDOWS 2528#ifndef HAVE_X_WINDOWS
2548 if (!internal_terminal || inhibit_window_system) 2529 if (!internal_terminal || inhibit_window_system)
2549 { 2530 {
@@ -2631,7 +2612,7 @@ dos_get_saved_screen (screen, rows, cols)
2631 return *screen != (char *)0; 2612 return *screen != (char *)0;
2632#else 2613#else
2633 return 0; 2614 return 0;
2634#endif 2615#endif
2635} 2616}
2636 2617
2637#ifndef HAVE_X_WINDOWS 2618#ifndef HAVE_X_WINDOWS
@@ -2801,7 +2782,7 @@ dos_set_keyboard (code, always)
2801 keyboard = keyboard_layout_list[0].keyboard_map; 2782 keyboard = keyboard_layout_list[0].keyboard_map;
2802 keyboard_map_all = always; 2783 keyboard_map_all = always;
2803 dos_keyboard_layout = 1; 2784 dos_keyboard_layout = 1;
2804 2785
2805 for (i = 0; i < (sizeof (keyboard_layout_list)/sizeof (struct keyboard_layout_list)); i++) 2786 for (i = 0; i < (sizeof (keyboard_layout_list)/sizeof (struct keyboard_layout_list)); i++)
2806 if (code == keyboard_layout_list[i].country_code) 2787 if (code == keyboard_layout_list[i].country_code)
2807 { 2788 {
@@ -2878,7 +2859,7 @@ ibmpc_translate_map[] =
2878 Map | 23, /* 'o' */ 2859 Map | 23, /* 'o' */
2879 Map | 24, /* 'p' */ 2860 Map | 24, /* 'p' */
2880 Map | 25, /* '[' */ 2861 Map | 25, /* '[' */
2881 Map | 26, /* ']' */ 2862 Map | 26, /* ']' */
2882 ModFct | 0x0d, /* Return */ 2863 ModFct | 0x0d, /* Return */
2883 Ignore, /* Ctrl */ 2864 Ignore, /* Ctrl */
2884 Map | 30, /* 'a' */ 2865 Map | 30, /* 'a' */
@@ -3054,23 +3035,22 @@ dos_get_modifiers (keymask)
3054 int *keymask; 3035 int *keymask;
3055{ 3036{
3056 union REGS regs; 3037 union REGS regs;
3057 int mask; 3038 int mask, modifiers = 0;
3058 int modifiers = 0; 3039
3059
3060 /* Calculate modifier bits */ 3040 /* Calculate modifier bits */
3061 regs.h.ah = extended_kbd ? 0x12 : 0x02; 3041 regs.h.ah = extended_kbd ? 0x12 : 0x02;
3062 int86 (0x16, &regs, &regs); 3042 int86 (0x16, &regs, &regs);
3063 3043
3064 if (!extended_kbd) 3044 if (!extended_kbd)
3065 { 3045 {
3066 mask = regs.h.al & (SHIFT_P | CTRL_P | ALT_P | 3046 mask = regs.h.al & (SHIFT_P | CTRL_P | ALT_P |
3067 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P); 3047 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);
3068 } 3048 }
3069 else 3049 else
3070 { 3050 {
3071 mask = regs.h.al & (SHIFT_P | 3051 mask = regs.h.al & (SHIFT_P |
3072 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P); 3052 SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);
3073 3053
3074 /* Do not break international keyboard support. */ 3054 /* Do not break international keyboard support. */
3075 /* When Keyb.Com is loaded, the right Alt key is */ 3055 /* When Keyb.Com is loaded, the right Alt key is */
3076 /* used for accessing characters like { and } */ 3056 /* used for accessing characters like { and } */
@@ -3098,7 +3078,7 @@ dos_get_modifiers (keymask)
3098 mask |= ALT_P; 3078 mask |= ALT_P;
3099 } 3079 }
3100 } 3080 }
3101 3081
3102 if (regs.h.ah & 1) /* Left CTRL pressed ? */ 3082 if (regs.h.ah & 1) /* Left CTRL pressed ? */
3103 mask |= CTRL_P; 3083 mask |= CTRL_P;
3104 3084
@@ -3142,8 +3122,7 @@ Each input key receives two values in this vector: first the ASCII code,
3142and then the scan code. */) 3122and then the scan code. */)
3143 () 3123 ()
3144{ 3124{
3145 Lisp_Object *keys = XVECTOR (recent_doskeys)->contents; 3125 Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents;
3146 Lisp_Object val;
3147 3126
3148 if (total_doskeys < NUM_RECENT_DOSKEYS) 3127 if (total_doskeys < NUM_RECENT_DOSKEYS)
3149 return Fvector (total_doskeys, keys); 3128 return Fvector (total_doskeys, keys);
@@ -3167,7 +3146,7 @@ dos_rawgetc ()
3167 struct input_event event; 3146 struct input_event event;
3168 union REGS regs; 3147 union REGS regs;
3169 struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); 3148 struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME());
3170 3149
3171#ifndef HAVE_X_WINDOWS 3150#ifndef HAVE_X_WINDOWS
3172 /* Maybe put the cursor where it should be. */ 3151 /* Maybe put the cursor where it should be. */
3173 IT_cmgoto (SELECTED_FRAME()); 3152 IT_cmgoto (SELECTED_FRAME());
@@ -3181,8 +3160,7 @@ dos_rawgetc ()
3181 { 3160 {
3182 union REGS regs; 3161 union REGS regs;
3183 register unsigned char c; 3162 register unsigned char c;
3184 int sc, code = -1, mask, kp_mode; 3163 int modifiers, sc, code = -1, mask, kp_mode;
3185 int modifiers;
3186 3164
3187 regs.h.ah = extended_kbd ? 0x10 : 0x00; 3165 regs.h.ah = extended_kbd ? 0x10 : 0x00;
3188 int86 (0x16, &regs, &regs); 3166 int86 (0x16, &regs, &regs);
@@ -3200,7 +3178,7 @@ dos_rawgetc ()
3200 recent_doskeys_index = 0; 3178 recent_doskeys_index = 0;
3201 3179
3202 modifiers = dos_get_modifiers (&mask); 3180 modifiers = dos_get_modifiers (&mask);
3203 3181
3204#ifndef HAVE_X_WINDOWS 3182#ifndef HAVE_X_WINDOWS
3205 if (!NILP (Vdos_display_scancodes)) 3183 if (!NILP (Vdos_display_scancodes))
3206 { 3184 {
@@ -3256,7 +3234,7 @@ dos_rawgetc ()
3256 continue; 3234 continue;
3257 } 3235 }
3258 } 3236 }
3259 3237
3260 if (c == 0) 3238 if (c == 0)
3261 { 3239 {
3262 /* We only look at the keyboard Ctrl/Shift/Alt keys when 3240 /* We only look at the keyboard Ctrl/Shift/Alt keys when
@@ -3278,22 +3256,22 @@ dos_rawgetc ()
3278 if (code & Shift) 3256 if (code & Shift)
3279 modifiers |= shift_modifier; 3257 modifiers |= shift_modifier;
3280 } 3258 }
3281 3259
3282 switch (code & 0xf000) 3260 switch (code & 0xf000)
3283 { 3261 {
3284 case ModFct: 3262 case ModFct:
3285 if (c && !(mask & (SHIFT_P | ALT_P | CTRL_P | HYPER_P | SUPER_P))) 3263 if (c && !(mask & (SHIFT_P | ALT_P | CTRL_P | HYPER_P | SUPER_P)))
3286 return c; 3264 return c;
3287 c = 0; /* Special */ 3265 c = 0; /* Special */
3288 3266
3289 case FctKey: 3267 case FctKey:
3290 if (c != 0) 3268 if (c != 0)
3291 return c; 3269 return c;
3292 3270
3293 case Special: 3271 case Special:
3294 code |= 0xff00; 3272 code |= 0xff00;
3295 break; 3273 break;
3296 3274
3297 case Normal: 3275 case Normal:
3298 if (sc == 0) 3276 if (sc == 0)
3299 { 3277 {
@@ -3308,7 +3286,7 @@ dos_rawgetc ()
3308 code = c; 3286 code = c;
3309 break; 3287 break;
3310 } 3288 }
3311 3289
3312 case Map: 3290 case Map:
3313 if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P))) 3291 if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P)))
3314 if (!keyboard_map_all) 3292 if (!keyboard_map_all)
@@ -3317,7 +3295,7 @@ dos_rawgetc ()
3317 code &= 0xff; 3295 code &= 0xff;
3318 if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200) 3296 if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200)
3319 mask |= SHIFT_P; /* ALT-1 => M-! etc. */ 3297 mask |= SHIFT_P; /* ALT-1 => M-! etc. */
3320 3298
3321 if (mask & SHIFT_P) 3299 if (mask & SHIFT_P)
3322 { 3300 {
3323 code = keyboard->shifted[code]; 3301 code = keyboard->shifted[code];
@@ -3340,7 +3318,7 @@ dos_rawgetc ()
3340 kp_mode = dos_keypad_mode & 0x03; 3318 kp_mode = dos_keypad_mode & 0x03;
3341 else 3319 else
3342 kp_mode = (dos_keypad_mode >> 4) & 0x03; 3320 kp_mode = (dos_keypad_mode >> 4) & 0x03;
3343 3321
3344 switch (kp_mode) 3322 switch (kp_mode)
3345 { 3323 {
3346 case 0: 3324 case 0:
@@ -3356,13 +3334,13 @@ dos_rawgetc ()
3356 code = keypad_translate_map[code].meta_code; 3334 code = keypad_translate_map[code].meta_code;
3357 modifiers = meta_modifier; 3335 modifiers = meta_modifier;
3358 break; 3336 break;
3359 3337
3360 case 3: 3338 case 3:
3361 code = 0xff00 | keypad_translate_map[code].editkey_code; 3339 code = 0xff00 | keypad_translate_map[code].editkey_code;
3362 break; 3340 break;
3363 } 3341 }
3364 break; 3342 break;
3365 3343
3366 case Grey: 3344 case Grey:
3367 code &= 0xff; 3345 code &= 0xff;
3368 kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40; 3346 kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40;
@@ -3372,7 +3350,7 @@ dos_rawgetc ()
3372 code = grey_key_translate_map[code].char_code; 3350 code = grey_key_translate_map[code].char_code;
3373 break; 3351 break;
3374 } 3352 }
3375 3353
3376 make_event: 3354 make_event:
3377 if (code == 0) 3355 if (code == 0)
3378 continue; 3356 continue;
@@ -3543,8 +3521,7 @@ dos_keyread ()
3543void 3521void
3544pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) 3522pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
3545 FRAME_PTR f; 3523 FRAME_PTR f;
3546 register int pix_x, pix_y; 3524 register int pix_x, pix_y, *x, *y;
3547 register int *x, *y;
3548 XRectangle *bounds; 3525 XRectangle *bounds;
3549 int noclip; 3526 int noclip;
3550{ 3527{
@@ -3559,8 +3536,7 @@ pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
3559void 3536void
3560glyph_to_pixel_coords (f, x, y, pix_x, pix_y) 3537glyph_to_pixel_coords (f, x, y, pix_x, pix_y)
3561 FRAME_PTR f; 3538 FRAME_PTR f;
3562 register int x, y; 3539 register int x, y, *pix_x, *pix_y;
3563 register int *pix_x, *pix_y;
3564{ 3540{
3565 *pix_x = x; 3541 *pix_x = x;
3566 *pix_y = y; 3542 *pix_y = y;
@@ -3664,12 +3640,9 @@ IT_menu_calc_size (XMenu *menu, int *width, int *height)
3664static void 3640static void
3665IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help) 3641IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)
3666{ 3642{
3667 int i, j, face, width; 3643 int i, j, face, width, mx, my, enabled, mousehere, row, col;
3668 struct glyph *text, *p; 3644 struct glyph *text, *p;
3669 char *q; 3645 char *q;
3670 int mx, my;
3671 int enabled, mousehere;
3672 int row, col;
3673 struct frame *sf = SELECTED_FRAME(); 3646 struct frame *sf = SELECTED_FRAME();
3674 3647
3675 menu_help_message = NULL; 3648 menu_help_message = NULL;
@@ -3738,10 +3711,7 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)
3738/* Report availability of menus. */ 3711/* Report availability of menus. */
3739 3712
3740int 3713int
3741have_menus_p () 3714have_menus_p () { return 1; }
3742{
3743 return 1;
3744}
3745 3715
3746/* Create a brand new menu structure. */ 3716/* Create a brand new menu structure. */
3747 3717
@@ -3843,16 +3813,11 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
3843 void (*help_callback)(char *, int, int)) 3813 void (*help_callback)(char *, int, int))
3844{ 3814{
3845 struct IT_menu_state *state; 3815 struct IT_menu_state *state;
3846 int statecount; 3816 int statecount, x, y, i, b, screensize, leave, result, onepane;
3847 int x, y, i, b;
3848 int screensize;
3849 int faces[4];
3850 Lisp_Object selectface;
3851 int leave, result, onepane;
3852 int title_faces[4]; /* face to display the menu title */ 3817 int title_faces[4]; /* face to display the menu title */
3853 int buffers_num_deleted = 0; 3818 int faces[4], buffers_num_deleted = 0;
3854 struct frame *sf = SELECTED_FRAME(); 3819 struct frame *sf = SELECTED_FRAME();
3855 Lisp_Object saved_echo_area_message; 3820 Lisp_Object saved_echo_area_message, selectface;
3856 3821
3857 /* Just in case we got here without a mouse present... */ 3822 /* Just in case we got here without a mouse present... */
3858 if (have_mouse <= 0) 3823 if (have_mouse <= 0)
@@ -3891,7 +3856,7 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
3891 3856
3892 /* Don't let the title for the "Buffers" popup menu include a 3857 /* Don't let the title for the "Buffers" popup menu include a
3893 digit (which is ugly). 3858 digit (which is ugly).
3894 3859
3895 This is a terrible kludge, but I think the "Buffers" case is 3860 This is a terrible kludge, but I think the "Buffers" case is
3896 the only one where the title includes a number, so it doesn't 3861 the only one where the title includes a number, so it doesn't
3897 seem to be necessary to make this more general. */ 3862 seem to be necessary to make this more general. */
@@ -3983,7 +3948,7 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
3983 state[statecount].x 3948 state[statecount].x
3984 = state[i].x + state[i].menu->width + 2; 3949 = state[i].x + state[i].menu->width + 2;
3985 state[statecount].y = y; 3950 state[statecount].y = y;
3986 statecount++; 3951 statecount++;
3987 } 3952 }
3988 } 3953 }
3989 } 3954 }
@@ -4144,8 +4109,7 @@ getdefdir (drive, dst)
4144 int drive; 4109 int drive;
4145 char *dst; 4110 char *dst;
4146{ 4111{
4147 char in_path[4], *p = in_path; 4112 char in_path[4], *p = in_path, e = errno;;
4148 int e = errno;
4149 4113
4150 /* Generate "X:." (when drive is X) or "." (when drive is 0). */ 4114 /* Generate "X:." (when drive is X) or "." (when drive is 0). */
4151 if (drive != 0) 4115 if (drive != 0)
@@ -4186,9 +4150,7 @@ crlf_to_lf (n, buf)
4186 register int n; 4150 register int n;
4187 register unsigned char *buf; 4151 register unsigned char *buf;
4188{ 4152{
4189 unsigned char *np = buf; 4153 unsigned char *np = buf, *startp = buf, *endp = buf + n;
4190 unsigned char *startp = buf;
4191 unsigned char *endp = buf + n;
4192 4154
4193 if (n == 0) 4155 if (n == 0)
4194 return n; 4156 return n;
@@ -4283,7 +4245,7 @@ __write (int handle, const void *buffer, size_t count)
4283 used when you compile with DJGPP v2.0. */ 4245 used when you compile with DJGPP v2.0. */
4284 4246
4285#include <io.h> 4247#include <io.h>
4286 4248
4287int _rename(const char *old, const char *new) 4249int _rename(const char *old, const char *new)
4288{ 4250{
4289 __dpmi_regs r; 4251 __dpmi_regs r;
@@ -4474,11 +4436,10 @@ init_environment (argc, argv, skip_args)
4474 int skip_args; 4436 int skip_args;
4475{ 4437{
4476 char *s, *t, *root; 4438 char *s, *t, *root;
4477 int len; 4439 int len, i;
4478 static const char * const tempdirs[] = { 4440 static const char * const tempdirs[] = {
4479 "$TMPDIR", "$TEMP", "$TMP", "c:/" 4441 "$TMPDIR", "$TEMP", "$TMP", "c:/"
4480 }; 4442 };
4481 int i;
4482 const int imax = sizeof (tempdirs) / sizeof (tempdirs[0]); 4443 const int imax = sizeof (tempdirs) / sizeof (tempdirs[0]);
4483 4444
4484 /* Make sure they have a usable $TMPDIR. Many Emacs functions use 4445 /* Make sure they have a usable $TMPDIR. Many Emacs functions use
@@ -4664,7 +4625,7 @@ dos_ttraw ()
4664{ 4625{
4665 union REGS inregs, outregs; 4626 union REGS inregs, outregs;
4666 static int first_time = 1; 4627 static int first_time = 1;
4667 4628
4668 break_stat = getcbrk (); 4629 break_stat = getcbrk ();
4669 setcbrk (0); 4630 setcbrk (0);
4670#if __DJGPP__ < 2 4631#if __DJGPP__ < 2
@@ -4676,7 +4637,7 @@ dos_ttraw ()
4676 inregs.h.ah = 0xc0; 4637 inregs.h.ah = 0xc0;
4677 int86 (0x15, &inregs, &outregs); 4638 int86 (0x15, &inregs, &outregs);
4678 extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0); 4639 extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0);
4679 4640
4680 have_mouse = 0; 4641 have_mouse = 0;
4681 4642
4682 if (internal_terminal 4643 if (internal_terminal
@@ -4795,9 +4756,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4795{ 4756{
4796 char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl; 4757 char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl;
4797 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ 4758 char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */
4798 int msshell, result = -1; 4759 int msshell, result = -1, inbak, outbak, errbak, x, y;
4799 int inbak, outbak, errbak;
4800 int x, y;
4801 Lisp_Object cmd; 4760 Lisp_Object cmd;
4802 4761
4803 /* Get current directory as MSDOS cwd is not per-process. */ 4762 /* Get current directory as MSDOS cwd is not per-process. */
@@ -4854,7 +4813,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4854 mouse_get_xy (&x, &y); 4813 mouse_get_xy (&x, &y);
4855 4814
4856 dos_ttcooked (); /* do it here while 0 = stdin */ 4815 dos_ttcooked (); /* do it here while 0 = stdin */
4857 4816
4858 dup2 (tempin, 0); 4817 dup2 (tempin, 0);
4859 dup2 (tempout, 1); 4818 dup2 (tempout, 1);
4860 dup2 (temperr, 2); 4819 dup2 (temperr, 2);
@@ -4905,7 +4864,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4905#endif /* __DJGPP__ > 1 */ 4864#endif /* __DJGPP__ > 1 */
4906 4865
4907 result = spawnve (P_WAIT, argv[0], argv, envv); 4866 result = spawnve (P_WAIT, argv[0], argv, envv);
4908 4867
4909 dup2 (inbak, 0); 4868 dup2 (inbak, 0);
4910 dup2 (outbak, 1); 4869 dup2 (outbak, 1);
4911 dup2 (errbak, 2); 4870 dup2 (errbak, 2);
@@ -4924,7 +4883,7 @@ run_msdos_command (argv, working_dir, tempin, tempout, temperr, envv)
4924 text attribute byte, so we get blinking characters instead of the 4883 text attribute byte, so we get blinking characters instead of the
4925 bright background colors. Restore that. */ 4884 bright background colors. Restore that. */
4926 bright_bg (); 4885 bright_bg ();
4927 4886
4928 done: 4887 done:
4929 chdir (oldwd); 4888 chdir (oldwd);
4930 if (msshell) 4889 if (msshell)
@@ -4979,7 +4938,7 @@ gettimeofday (struct timeval *tp, struct timezone *tzp)
4979 { 4938 {
4980 struct time t; 4939 struct time t;
4981 struct tm tm; 4940 struct tm tm;
4982 4941
4983 gettime (&t); 4942 gettime (&t);
4984 if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */ 4943 if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */
4985 { 4944 {
@@ -4989,14 +4948,14 @@ gettimeofday (struct timeval *tp, struct timezone *tzp)
4989 time_rec.tm_mon = d.da_mon - 1; 4948 time_rec.tm_mon = d.da_mon - 1;
4990 time_rec.tm_mday = d.da_day; 4949 time_rec.tm_mday = d.da_day;
4991 } 4950 }
4992 4951
4993 time_rec.tm_hour = t.ti_hour; 4952 time_rec.tm_hour = t.ti_hour;
4994 time_rec.tm_min = t.ti_min; 4953 time_rec.tm_min = t.ti_min;
4995 time_rec.tm_sec = t.ti_sec; 4954 time_rec.tm_sec = t.ti_sec;
4996 4955
4997 tm = time_rec; 4956 tm = time_rec;
4998 tm.tm_gmtoff = dos_timezone_offset; 4957 tm.tm_gmtoff = dos_timezone_offset;
4999 4958
5000 tp->tv_sec = mktime (&tm); /* may modify tm */ 4959 tp->tv_sec = mktime (&tm); /* may modify tm */
5001 tp->tv_usec = t.ti_hund * (1000000 / 100); 4960 tp->tv_usec = t.ti_hund * (1000000 / 100);
5002 } 4961 }
@@ -5017,7 +4976,7 @@ int kill (x, y) int x, y; { return -1; }
5017nice (p) int p; {} 4976nice (p) int p; {}
5018void volatile pause () {} 4977void volatile pause () {}
5019sigsetmask (x) int x; { return 0; } 4978sigsetmask (x) int x; { return 0; }
5020sigblock (mask) int mask; { return 0; } 4979sigblock (mask) int mask; { return 0; }
5021#endif 4980#endif
5022 4981
5023void request_sigio (void) {} 4982void request_sigio (void) {}
@@ -5026,6 +4985,7 @@ setpriority (x,y,z) int x,y,z; { return 0; }
5026void unrequest_sigio (void) {} 4985void unrequest_sigio (void) {}
5027 4986
5028#if __DJGPP__ > 1 4987#if __DJGPP__ > 1
4988#if __DJGPP_MINOR__ < 2
5029 4989
5030#ifdef POSIX_SIGNALS 4990#ifdef POSIX_SIGNALS
5031 4991
@@ -5132,6 +5092,7 @@ sigsetmask (x) int x; { return 0; }
5132sigblock (mask) int mask; { return 0; } 5092sigblock (mask) int mask; { return 0; }
5133 5093
5134#endif /* not POSIX_SIGNALS */ 5094#endif /* not POSIX_SIGNALS */
5095#endif /* not __DJGPP_MINOR__ < 2 */
5135#endif /* __DJGPP__ > 1 */ 5096#endif /* __DJGPP__ > 1 */
5136 5097
5137#ifndef HAVE_SELECT 5098#ifndef HAVE_SELECT
@@ -5189,7 +5150,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
5189 5150
5190 if (nfds != 1) 5151 if (nfds != 1)
5191 abort (); 5152 abort ();
5192 5153
5193 /* If we are looking only for the terminal, with no timeout, 5154 /* If we are looking only for the terminal, with no timeout,
5194 just read it and wait -- that's more efficient. */ 5155 just read it and wait -- that's more efficient. */
5195 if (!timeout) 5156 if (!timeout)
@@ -5225,7 +5186,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
5225 dos_yield_time_slice (); 5186 dos_yield_time_slice ();
5226 } 5187 }
5227 } 5188 }
5228 5189
5229 FD_SET (0, rfds); 5190 FD_SET (0, rfds);
5230 return 1; 5191 return 1;
5231} 5192}
@@ -5257,7 +5218,7 @@ sys_chdir (path)
5257 tmp += 2; /* strip drive: KFS 1995-07-06 */ 5218 tmp += 2; /* strip drive: KFS 1995-07-06 */
5258 len -= 2; 5219 len -= 2;
5259 } 5220 }
5260 5221
5261 if (len > 1 && (tmp[len - 1] == '/')) 5222 if (len > 1 && (tmp[len - 1] == '/'))
5262 { 5223 {
5263 char *tmp1 = (char *) alloca (len + 1); 5224 char *tmp1 = (char *) alloca (len + 1);
@@ -5298,7 +5259,7 @@ dos_abort (file, line)
5298{ 5259{
5299 char buffer1[200], buffer2[400]; 5260 char buffer1[200], buffer2[400];
5300 int i, j; 5261 int i, j;
5301 5262
5302 sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line); 5263 sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line);
5303 for (i = j = 0; buffer1[i]; i++) { 5264 for (i = j = 0; buffer1[i]; i++) {
5304 buffer2[j++] = buffer1[i]; 5265 buffer2[j++] = buffer1[i];
@@ -5387,4 +5348,3 @@ nil means don't delete them until `list-processes' is run. */);
5387} 5348}
5388 5349
5389#endif /* MSDOS */ 5350#endif /* MSDOS */
5390