Mercurial > emacs
comparison src/msdos.c @ 13274:712386e1abe0
Whitespace changes.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 22 Oct 1995 18:28:17 +0000 |
parents | b0de215331ba |
children | 63a43c4b29b2 |
comparison
equal
deleted
inserted
replaced
13273:335d844a2f05 | 13274:712386e1abe0 |
---|---|
563 | 563 |
564 static | 564 static |
565 IT_reset_terminal_modes (void) | 565 IT_reset_terminal_modes (void) |
566 { | 566 { |
567 if (termscript) | 567 if (termscript) |
568 fprintf(termscript, "\n<RESET_TERM>"); | 568 fprintf (termscript, "\n<RESET_TERM>"); |
569 | 569 |
570 highlight = 0; | 570 highlight = 0; |
571 | 571 |
572 if (!term_setup_done) | 572 if (!term_setup_done) |
573 return; | 573 return; |
663 | 663 |
664 internal_terminal | 664 internal_terminal |
665 = (!noninteractive) && term && !strcmp (term, "internal"); | 665 = (!noninteractive) && term && !strcmp (term, "internal"); |
666 | 666 |
667 if (getenv ("EMACSTEST")) | 667 if (getenv ("EMACSTEST")) |
668 termscript = fopen(getenv ("EMACSTEST"), "wt"); | 668 termscript = fopen (getenv ("EMACSTEST"), "wt"); |
669 | 669 |
670 #ifndef HAVE_X_WINDOWS | 670 #ifndef HAVE_X_WINDOWS |
671 if (!internal_terminal || inhibit_window_system) | 671 if (!internal_terminal || inhibit_window_system) |
672 { | 672 { |
673 the_only_frame.output_method = output_termcap; | 673 the_only_frame.output_method = output_termcap; |
678 Vwindow_system_version = make_number (1); | 678 Vwindow_system_version = make_number (1); |
679 | 679 |
680 bzero (&the_only_x_display, sizeof the_only_x_display); | 680 bzero (&the_only_x_display, sizeof the_only_x_display); |
681 the_only_x_display.background_pixel = 7; /* White */ | 681 the_only_x_display.background_pixel = 7; /* White */ |
682 the_only_x_display.foreground_pixel = 0; /* Black */ | 682 the_only_x_display.foreground_pixel = 0; /* Black */ |
683 colors = getenv("EMACSCOLORS"); | 683 colors = getenv ("EMACSCOLORS"); |
684 if (colors && strlen (colors) >= 2) | 684 if (colors && strlen (colors) >= 2) |
685 { | 685 { |
686 the_only_x_display.foreground_pixel = colors[0] & 0x07; | 686 the_only_x_display.foreground_pixel = colors[0] & 0x07; |
687 the_only_x_display.background_pixel = colors[1] & 0x07; | 687 the_only_x_display.background_pixel = colors[1] & 0x07; |
688 } | 688 } |
724 return 0; | 724 return 0; |
725 #endif | 725 #endif |
726 } | 726 } |
727 | 727 |
728 | 728 |
729 | |
729 /* ----------------------- Keyboard control ---------------------- | 730 /* ----------------------- Keyboard control ---------------------- |
730 * | 731 * |
731 * Keymaps reflect the following keyboard layout: | 732 * Keymaps reflect the following keyboard layout: |
732 * | 733 * |
733 * 0 1 2 3 4 5 6 7 8 9 10 11 12 BS | 734 * 0 1 2 3 4 5 6 7 8 9 10 11 12 BS |
778 | 779 |
779 static struct keyboard_layout_list | 780 static struct keyboard_layout_list |
780 { | 781 { |
781 int country_code; | 782 int country_code; |
782 struct dos_keyboard_map *keyboard_map; | 783 struct dos_keyboard_map *keyboard_map; |
783 } keyboard_layout_list[] = { | 784 } keyboard_layout_list[] = |
784 1, &us_keyboard, | 785 { |
785 33, &fr_keyboard, | 786 1, &us_keyboard, |
786 45, &dk_keyboard | 787 33, &fr_keyboard, |
788 45, &dk_keyboard | |
787 }; | 789 }; |
788 | 790 |
789 static struct dos_keyboard_map *keyboard; | 791 static struct dos_keyboard_map *keyboard; |
790 static int keyboard_map_all; | 792 static int keyboard_map_all; |
791 | 793 |
803 dos_keyboard_layout = code; | 805 dos_keyboard_layout = code; |
804 return 1; | 806 return 1; |
805 } | 807 } |
806 return 0; | 808 return 0; |
807 } | 809 } |
808 | 810 |
809 #define Ignore 0x0000 | 811 #define Ignore 0x0000 |
810 #define Normal 0x0000 /* normal key - alt changes scan-code */ | 812 #define Normal 0x0000 /* normal key - alt changes scan-code */ |
811 #define FctKey 0x1000 /* func key if c == 0, else c */ | 813 #define FctKey 0x1000 /* func key if c == 0, else c */ |
812 #define Special 0x2000 /* func key even if c != 0 */ | 814 #define Special 0x2000 /* func key even if c != 0 */ |
813 #define ModFct 0x3000 /* special if mod-keys, else 'c' */ | 815 #define ModFct 0x3000 /* special if mod-keys, else 'c' */ |
1041 Alt | KeyPad | 10, /* (Alt) Delete */ | 1043 Alt | KeyPad | 10, /* (Alt) Delete */ |
1042 Alt | Grey | 0, /* (Alt) Grey / */ | 1044 Alt | Grey | 0, /* (Alt) Grey / */ |
1043 Alt | FctKey | 0x09, /* (Alt) Tab */ | 1045 Alt | FctKey | 0x09, /* (Alt) Tab */ |
1044 Alt | Grey | 4 /* (Alt) Keypad Enter */ | 1046 Alt | Grey | 4 /* (Alt) Keypad Enter */ |
1045 }; | 1047 }; |
1046 | 1048 |
1047 /* These bit-positions corresponds to values returned by BIOS */ | 1049 /* These bit-positions corresponds to values returned by BIOS */ |
1048 #define SHIFT_P 0x0003 /* two bits! */ | 1050 #define SHIFT_P 0x0003 /* two bits! */ |
1049 #define CTRL_P 0x0004 | 1051 #define CTRL_P 0x0004 |
1050 #define ALT_P 0x0008 | 1052 #define ALT_P 0x0008 |
1051 #define SCRLOCK_P 0x0010 | 1053 #define SCRLOCK_P 0x0010 |
1136 { | 1138 { |
1137 struct input_event event; | 1139 struct input_event event; |
1138 union REGS regs; | 1140 union REGS regs; |
1139 | 1141 |
1140 #ifndef HAVE_X_WINDOWS | 1142 #ifndef HAVE_X_WINDOWS |
1141 SCREEN_SET_CURSOR(); | 1143 SCREEN_SET_CURSOR (); |
1142 if (!mouse_visible) mouse_on (); | 1144 if (!mouse_visible) mouse_on (); |
1143 #endif | 1145 #endif |
1144 | 1146 |
1145 /* The following condition is equivalent to `kbhit ()', except that | 1147 /* The following condition is equivalent to `kbhit ()', except that |
1146 it uses the bios to do its job. This pleases DESQview/X. */ | 1148 it uses the bios to do its job. This pleases DESQview/X. */ |
1156 regs.h.ah = extended_kbd ? 0x10 : 0x00; | 1158 regs.h.ah = extended_kbd ? 0x10 : 0x00; |
1157 int86 (0x16, ®s, ®s); | 1159 int86 (0x16, ®s, ®s); |
1158 c = regs.h.al; | 1160 c = regs.h.al; |
1159 sc = regs.h.ah; | 1161 sc = regs.h.ah; |
1160 | 1162 |
1161 modifiers = dos_get_modifiers( &mask ); | 1163 modifiers = dos_get_modifiers (&mask); |
1162 | 1164 |
1163 #ifndef HAVE_X_WINDOWS | 1165 #ifndef HAVE_X_WINDOWS |
1164 if (!NILP(Vdos_display_scancodes)) | 1166 if (!NILP (Vdos_display_scancodes)) |
1165 { | 1167 { |
1166 char buf[10]; | 1168 char buf[10]; |
1167 sprintf (buf, "%02x:%02x*%04x", | 1169 sprintf (buf, "%02x:%02x*%04x", |
1168 (unsigned) (sc&0xff), (unsigned) c, mask); | 1170 (unsigned) (sc&0xff), (unsigned) c, mask); |
1169 dos_direct_output (screen_size_Y - 2, screen_size_X - 12, buf, 10); | 1171 dos_direct_output (screen_size_Y - 2, screen_size_X - 12, buf, 10); |
1245 if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200) | 1247 if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200) |
1246 mask |= SHIFT_P; /* ALT-1 => M-! etc. */ | 1248 mask |= SHIFT_P; /* ALT-1 => M-! etc. */ |
1247 | 1249 |
1248 if (mask & SHIFT_P) | 1250 if (mask & SHIFT_P) |
1249 { | 1251 { |
1250 code = keyboard->shifted[ code ]; | 1252 code = keyboard->shifted[code]; |
1251 mask -= SHIFT_P; | 1253 mask -= SHIFT_P; |
1252 modifiers &= ~shift_modifier; | 1254 modifiers &= ~shift_modifier; |
1253 } | 1255 } |
1254 else | 1256 else |
1255 if ((mask & ALT_GR_P) && keyboard->alt_gr && keyboard->alt_gr[ code ] != ' ') | 1257 if ((mask & ALT_GR_P) && keyboard->alt_gr && keyboard->alt_gr[code] != ' ') |
1256 code = keyboard->alt_gr[ code ]; | 1258 code = keyboard->alt_gr[code]; |
1257 else | 1259 else |
1258 code = keyboard->unshifted[ code ]; | 1260 code = keyboard->unshifted[code]; |
1259 break; | 1261 break; |
1260 | 1262 |
1261 case KeyPad: | 1263 case KeyPad: |
1262 code &= 0xff; | 1264 code &= 0xff; |
1263 if (c == 0xe0) /* edit key */ | 1265 if (c == 0xe0) /* edit key */ |
1271 switch (kp_mode) | 1273 switch (kp_mode) |
1272 { | 1274 { |
1273 case 0: | 1275 case 0: |
1274 if (code == 10 && dos_decimal_point) | 1276 if (code == 10 && dos_decimal_point) |
1275 return dos_decimal_point; | 1277 return dos_decimal_point; |
1276 return keypad_translate_map[ code ].char_code; | 1278 return keypad_translate_map[code].char_code; |
1277 | 1279 |
1278 case 1: | 1280 case 1: |
1279 code = 0xff00 | keypad_translate_map[ code ].keypad_code; | 1281 code = 0xff00 | keypad_translate_map[code].keypad_code; |
1280 break; | 1282 break; |
1281 | 1283 |
1282 case 2: | 1284 case 2: |
1283 code = keypad_translate_map[ code ].meta_code; | 1285 code = keypad_translate_map[code].meta_code; |
1284 modifiers = meta_modifier; | 1286 modifiers = meta_modifier; |
1285 break; | 1287 break; |
1286 | 1288 |
1287 case 3: | 1289 case 3: |
1288 code = 0xff00 | keypad_translate_map[ code ].editkey_code; | 1290 code = 0xff00 | keypad_translate_map[code].editkey_code; |
1289 break; | 1291 break; |
1290 } | 1292 } |
1291 break; | 1293 break; |
1292 | 1294 |
1293 case Grey: | 1295 case Grey: |
1294 code &= 0xff; | 1296 code &= 0xff; |
1295 kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40; | 1297 kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40; |
1296 if (dos_keypad_mode & kp_mode) | 1298 if (dos_keypad_mode & kp_mode) |
1297 code = 0xff00 | grey_key_translate_map[ code ].keypad_code; | 1299 code = 0xff00 | grey_key_translate_map[code].keypad_code; |
1298 else | 1300 else |
1299 code = grey_key_translate_map[ code ].char_code; | 1301 code = grey_key_translate_map[code].char_code; |
1300 break; | 1302 break; |
1301 } | 1303 } |
1302 | 1304 |
1303 make_event: | 1305 make_event: |
1304 if (code == 0) | 1306 if (code == 0) |
1923 setenv ("NAME", getenv ("USER"), 0); | 1925 setenv ("NAME", getenv ("USER"), 0); |
1924 | 1926 |
1925 /* Time zone determined from country code. To make this possible, the | 1927 /* Time zone determined from country code. To make this possible, the |
1926 country code may not span more than one time zone. In other words, | 1928 country code may not span more than one time zone. In other words, |
1927 in the USA, you lose. */ | 1929 in the USA, you lose. */ |
1928 if (!getenv("TZ")) | 1930 if (!getenv ("TZ")) |
1929 switch (dos_country_code) | 1931 switch (dos_country_code) |
1930 { | 1932 { |
1931 case 31: /* Belgium */ | 1933 case 31: /* Belgium */ |
1932 case 32: /* The Netherlands */ | 1934 case 32: /* The Netherlands */ |
1933 case 33: /* France */ | 1935 case 33: /* France */ |
2180 dup2 (errbak, 2); | 2182 dup2 (errbak, 2); |
2181 close (inbak); | 2183 close (inbak); |
2182 close (outbak); | 2184 close (outbak); |
2183 close (errbak); | 2185 close (errbak); |
2184 | 2186 |
2185 dos_ttraw(); | 2187 dos_ttraw (); |
2186 if (have_mouse > 0) | 2188 if (have_mouse > 0) |
2187 { | 2189 { |
2188 mouse_init (); | 2190 mouse_init (); |
2189 mouse_moveto (x, y); | 2191 mouse_moveto (x, y); |
2190 } | 2192 } |