/[emacs]/emacs/src/msdos.c
ViewVC logotype

Diff of /emacs/src/msdos.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.172 by eliz, Fri Apr 19 12:13:47 2002 UTC revision 1.173 by eliz, Fri May 17 13:12:37 2002 UTC
# Line 109  event_timestamp () Line 109  event_timestamp ()
109  {  {
110    struct time t;    struct time t;
111    unsigned long s;    unsigned long s;
112      
113    gettime (&t);    gettime (&t);
114    s = t.ti_min;    s = t.ti_min;
115    s *= 60;    s *= 60;
116    s += t.ti_sec;    s += t.ti_sec;
117    s *= 1000;    s *= 1000;
118    s += t.ti_hund * 10;    s += t.ti_hund * 10;
119      
120    return s;    return s;
121  }  }
122    
# Line 439  dosv_refresh_virtual_screen (int offset, Line 439  dosv_refresh_virtual_screen (int offset,
439    
440  static void  static void
441  dos_direct_output (y, x, buf, len)  dos_direct_output (y, x, buf, len)
442       int y;       int x, y;
      int x;  
443       char *buf;       char *buf;
444       int len;       int len;
445  {  {
# Line 568  dos_set_window_size (rows, cols) Line 567  dos_set_window_size (rows, cols)
567       int *rows, *cols;       int *rows, *cols;
568  {  {
569    char video_name[30];    char video_name[30];
   Lisp_Object video_mode;  
   int video_mode_value;  
   int have_vga = 0;  
570    union REGS regs;    union REGS regs;
571      Lisp_Object video_mode;
572      int video_mode_value, have_vga = 0;
573    int current_rows = ScreenRows (), current_cols = ScreenCols ();    int current_rows = ScreenRows (), current_cols = ScreenCols ();
574    
575    if (*rows == current_rows && *cols == current_cols)    if (*rows == current_rows && *cols == current_cols)
# Line 610  dos_set_window_size (rows, cols) Line 608  dos_set_window_size (rows, cols)
608    else    else
609      {      {
610        static struct {        static struct {
611          int rows;          int rows, need_vga;
         int need_vga;  
612        } std_dimension[] = {        } std_dimension[] = {
613            {25, 0},            {25, 0},
614            {28, 1},            {28, 1},
# Line 720  static void Line 717  static void
717  mouse_off_maybe ()  mouse_off_maybe ()
718  {  {
719    int x, y;    int x, y;
720      
721    if (!mouse_visible)    if (!mouse_visible)
722      return;      return;
723      
724    mouse_get_xy (&x, &y);    mouse_get_xy (&x, &y);
725    if (y != new_pos_Y || x < new_pos_X)    if (y != new_pos_Y || x < new_pos_X)
726      return;      return;
727      
728    mouse_off ();    mouse_off ();
729  }  }
730    
# Line 977  IT_write_glyphs (struct glyph *str, int Line 974  IT_write_glyphs (struct glyph *str, int
974    int conversion_buffer_size = sizeof conversion_buffer;    int conversion_buffer_size = sizeof conversion_buffer;
975    
976    if (str_len <= 0) return;    if (str_len <= 0) return;
977      
978    screen_buf = screen_bp = alloca (str_len * 2);    screen_buf = screen_bp = alloca (str_len * 2);
979    screen_buf_end = screen_buf + str_len * 2;    screen_buf_end = screen_buf + str_len * 2;
980    sf = SELECTED_FRAME();    sf = SELECTED_FRAME();
# Line 988  IT_write_glyphs (struct glyph *str, int Line 985  IT_write_glyphs (struct glyph *str, int
985       face of the frame, before writing glyphs, and let the glyphs       face of the frame, before writing glyphs, and let the glyphs
986       set the right face if it's different from the default.  */       set the right face if it's different from the default.  */
987    IT_set_face (DEFAULT_FACE_ID);    IT_set_face (DEFAULT_FACE_ID);
988      
989    /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at    /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
990       the tail.  */       the tail.  */
991    terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;    terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
# Line 1227  show_mouse_face (struct display_info *dp Line 1224  show_mouse_face (struct display_info *dp
1224    int i;    int i;
1225    struct face *fp;    struct face *fp;
1226    
1227      
1228    /* If window is in the process of being destroyed, don't bother    /* If window is in the process of being destroyed, don't bother
1229       doing anything.  */       doing anything.  */
1230    if (w->current_matrix == NULL)    if (w->current_matrix == NULL)
# Line 1337  show_mouse_face (struct display_info *dp Line 1334  show_mouse_face (struct display_info *dp
1334      }      }
1335    
1336   set_cursor_shape:   set_cursor_shape:
     
1337    /* Change the mouse pointer shape.  */    /* Change the mouse pointer shape.  */
1338    IT_set_mouse_pointer (hl);    IT_set_mouse_pointer (hl);
1339  }  }
# Line 1362  clear_mouse_face (struct display_info *d Line 1358  clear_mouse_face (struct display_info *d
1358  static int  static int
1359  fast_find_position (struct window *w, int pos, int *hpos, int *vpos)  fast_find_position (struct window *w, int pos, int *hpos, int *vpos)
1360  {  {
1361    int i;    int i, lastcol, line_start_position, maybe_next_line_p = 0;
   int lastcol;  
   int maybe_next_line_p = 0;  
   int line_start_position;  
1362    int yb = window_text_bottom_y (w);    int yb = window_text_bottom_y (w);
1363    struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0);    struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row;
   struct glyph_row *best_row = row;  
1364    
1365    while (row->y < yb)    while (row->y < yb)
1366      {      {
# Line 1394  fast_find_position (struct window *w, in Line 1386  fast_find_position (struct window *w, in
1386           never-never land... */           never-never land... */
1387        if (row->y + 1 >= yb)        if (row->y + 1 >= yb)
1388          break;          break;
1389          
1390        ++row;        ++row;
1391      }      }
1392      
1393    /* Find the right column within BEST_ROW.  */    /* Find the right column within BEST_ROW.  */
1394    lastcol = 0;    lastcol = 0;
1395    row = best_row;    row = best_row;
# Line 1449  IT_note_mode_line_highlight (struct wind Line 1441  IT_note_mode_line_highlight (struct wind
1441      row = MATRIX_MODE_LINE_ROW (w->current_matrix);      row = MATRIX_MODE_LINE_ROW (w->current_matrix);
1442    else    else
1443      row = MATRIX_HEADER_LINE_ROW (w->current_matrix);      row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
1444      
1445    if (row->enabled_p)    if (row->enabled_p)
1446      {      {
1447        extern Lisp_Object Qhelp_echo;        extern Lisp_Object Qhelp_echo;
1448        struct glyph *glyph, *end;        struct glyph *glyph, *end;
1449        Lisp_Object help, map;        Lisp_Object help, map;
1450          
1451        /* Find the glyph under X.  */        /* Find the glyph under X.  */
1452        glyph = row->glyphs[TEXT_AREA]        glyph = row->glyphs[TEXT_AREA]
1453          + x - FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);          + x - FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);
# Line 1549  IT_note_mouse_highlight (struct frame *f Line 1541  IT_note_mouse_highlight (struct frame *f
1541        && (XFASTINT (w->last_overlay_modified)        && (XFASTINT (w->last_overlay_modified)
1542            == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))))            == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))))
1543      {      {
1544        int pos, i;        int pos, i, nrows = w->current_matrix->nrows;
1545        struct glyph_row *row;        struct glyph_row *row;
1546        struct glyph *glyph;        struct glyph *glyph;
       int nrows = w->current_matrix->nrows;  
1547    
1548        /* Find the glyph under X/Y.  */        /* Find the glyph under X/Y.  */
1549        glyph = NULL;        glyph = NULL;
# Line 1594  IT_note_mouse_highlight (struct frame *f Line 1585  IT_note_mouse_highlight (struct frame *f
1585        /* Check for mouse-face and help-echo.  */        /* Check for mouse-face and help-echo.  */
1586        {        {
1587          extern Lisp_Object Qmouse_face;          extern Lisp_Object Qmouse_face;
1588          Lisp_Object mouse_face, overlay, position;          Lisp_Object mouse_face, overlay, position, *overlay_vec;
1589          Lisp_Object *overlay_vec;          int len, noverlays, obegv, ozv;;
         int len, noverlays;  
1590          struct buffer *obuf;          struct buffer *obuf;
         int obegv, ozv;  
1591    
1592          /* If we get an out-of-range value, return now; avoid an error.  */          /* If we get an out-of-range value, return now; avoid an error.  */
1593          if (pos > BUF_Z (XBUFFER (w->buffer)))          if (pos > BUF_Z (XBUFFER (w->buffer)))
# Line 1629  IT_note_mouse_highlight (struct frame *f Line 1618  IT_note_mouse_highlight (struct frame *f
1618              noverlays = overlays_at (pos,              noverlays = overlays_at (pos,
1619                                       0, &overlay_vec, &len, NULL, NULL, 0);                                       0, &overlay_vec, &len, NULL, NULL, 0);
1620            }            }
1621              
1622          /* Sort overlays into increasing priority order.  */          /* Sort overlays into increasing priority order.  */
1623          noverlays = sort_overlays (overlay_vec, noverlays, w);          noverlays = sort_overlays (overlay_vec, noverlays, w);
1624    
# Line 1737  IT_note_mouse_highlight (struct frame *f Line 1726  IT_note_mouse_highlight (struct frame *f
1726                overlay = overlay_vec[i];                overlay = overlay_vec[i];
1727                help = Foverlay_get (overlay, Qhelp_echo);                help = Foverlay_get (overlay, Qhelp_echo);
1728              }              }
1729                
1730            if (!NILP (help))            if (!NILP (help))
1731              {              {
1732                help_echo = help;                help_echo = help;
# Line 1765  IT_note_mouse_highlight (struct frame *f Line 1754  IT_note_mouse_highlight (struct frame *f
1754                  }                  }
1755              }              }
1756          }          }
1757              
1758          BEGV = obegv;          BEGV = obegv;
1759          ZV = ozv;          ZV = ozv;
1760          current_buffer = obuf;          current_buffer = obuf;
# Line 1777  static void Line 1766  static void
1766  IT_clear_end_of_line (int first_unused)  IT_clear_end_of_line (int first_unused)
1767  {  {
1768    char *spaces, *sp;    char *spaces, *sp;
1769    int i, j;    int i, j, offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
   int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);  
1770    extern int fatal_error_in_progress;    extern int fatal_error_in_progress;
1771    
1772    if (new_pos_X >= first_unused || fatal_error_in_progress)    if (new_pos_X >= first_unused || fatal_error_in_progress)
# Line 1789  IT_clear_end_of_line (int first_unused) Line 1777  IT_clear_end_of_line (int first_unused)
1777    if (termscript)    if (termscript)
1778      fprintf (termscript, "<CLR:EOL[%d..%d)>", new_pos_X, first_unused);      fprintf (termscript, "<CLR:EOL[%d..%d)>", new_pos_X, first_unused);
1779    spaces = sp = alloca (i);    spaces = sp = alloca (i);
1780      
1781    while (--j >= 0)    while (--j >= 0)
1782      {      {
1783        *sp++ = ' ';        *sp++ = ' ';
# Line 2156  IT_set_terminal_modes (void) Line 2144  IT_set_terminal_modes (void)
2144    screen_size_X = ScreenCols ();    screen_size_X = ScreenCols ();
2145    screen_size_Y = ScreenRows ();    screen_size_Y = ScreenRows ();
2146    screen_size = screen_size_X * screen_size_Y;    screen_size = screen_size_X * screen_size_Y;
2147      
2148    new_pos_X = new_pos_Y = 0;    new_pos_X = new_pos_Y = 0;
2149    current_pos_X = current_pos_Y = -1;    current_pos_X = current_pos_Y = -1;
2150    
2151    if (term_setup_done)    if (term_setup_done)
2152      return;      return;
2153    term_setup_done = 1;    term_setup_done = 1;
2154      
2155    startup_screen_size_X = screen_size_X;    startup_screen_size_X = screen_size_X;
2156    startup_screen_size_Y = screen_size_Y;    startup_screen_size_Y = screen_size_Y;
2157    startup_screen_attrib = ScreenAttrib;    startup_screen_attrib = ScreenAttrib;
# Line 2219  IT_reset_terminal_modes (void) Line 2207  IT_reset_terminal_modes (void)
2207  {  {
2208    int display_row_start = (int) ScreenPrimary;    int display_row_start = (int) ScreenPrimary;
2209    int saved_row_len     = startup_screen_size_X * 2;    int saved_row_len     = startup_screen_size_X * 2;
2210    int update_row_len    = ScreenCols () * 2;    int update_row_len    = ScreenCols () * 2, current_rows = ScreenRows ();
   int current_rows      = ScreenRows ();  
2211    int to_next_row       = update_row_len;    int to_next_row       = update_row_len;
2212    unsigned char *saved_row = startup_screen_buffer;    unsigned char *saved_row = startup_screen_buffer;
2213    int cursor_pos_X = ScreenCols () - 1;    int cursor_pos_X = ScreenCols () - 1, cursor_pos_Y = ScreenRows () - 1;
   int cursor_pos_Y = ScreenRows () - 1;  
2214    
2215    if (termscript)    if (termscript)
2216      fprintf (termscript, "\n<RESET_TERM>");      fprintf (termscript, "\n<RESET_TERM>");
2217    
2218    if (!term_setup_done)    if (!term_setup_done)
2219      return;      return;
2220      
2221    mouse_off ();    mouse_off ();
2222    
2223    /* Leave the video system in the same state as we found it,    /* Leave the video system in the same state as we found it,
# Line 2331  IT_set_frame_parameters (f, alist) Line 2317  IT_set_frame_parameters (f, alist)
2317       Lisp_Object alist;       Lisp_Object alist;
2318  {  {
2319    Lisp_Object tail;    Lisp_Object tail;
2320    int length = XINT (Flength (alist));    int i, j, length = XINT (Flength (alist));
   int i, j;  
2321    Lisp_Object *parms    Lisp_Object *parms
2322      = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));      = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
2323    Lisp_Object *values    Lisp_Object *values
2324      = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));      = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
2325    /* Do we have to reverse the foreground and background colors?  */    /* Do we have to reverse the foreground and background colors?  */
2326    int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt);    int reverse = EQ (Fcdr (Fassq (Qreverse, f->param_alist)), Qt);
2327    int was_reverse = reverse;    int need_to_reverse, was_reverse = reverse;
2328    int redraw = 0, fg_set = 0, bg_set = 0;    int redraw = 0, fg_set = 0, bg_set = 0;
2329    int need_to_reverse;    unsigned long orig_fg, orig_bg;
   unsigned long orig_fg;  
   unsigned long orig_bg;  
2330    Lisp_Object frame_bg, frame_fg;    Lisp_Object frame_bg, frame_fg;
2331    extern Lisp_Object Qdefault, QCforeground, QCbackground;    extern Lisp_Object Qdefault, QCforeground, QCbackground;
2332    
# Line 2400  IT_set_frame_parameters (f, alist) Line 2383  IT_set_frame_parameters (f, alist)
2383    /* Now process the alist elements in reverse of specified order.  */    /* Now process the alist elements in reverse of specified order.  */
2384    for (i--; i >= 0; i--)    for (i--; i >= 0; i--)
2385      {      {
2386        Lisp_Object prop, val;        Lisp_Object prop, val, frame;
       Lisp_Object frame;  
2387    
2388        prop = parms[i];        prop = parms[i];
2389        val  = values[i];        val  = values[i];
# Line 2529  extern void init_frame_faces (FRAME_PTR) Line 2511  extern void init_frame_faces (FRAME_PTR)
2511  void  void
2512  internal_terminal_init ()  internal_terminal_init ()
2513  {  {
2514    char *term = getenv ("TERM");    char *term = getenv ("TERM"), *colors;
   char *colors;  
2515    struct frame *sf = SELECTED_FRAME();    struct frame *sf = SELECTED_FRAME();
2516    
2517  #ifdef HAVE_X_WINDOWS  #ifdef HAVE_X_WINDOWS
# Line 2543  internal_terminal_init () Line 2524  internal_terminal_init ()
2524    
2525    if (getenv ("EMACSTEST"))    if (getenv ("EMACSTEST"))
2526      termscript = fopen (getenv ("EMACSTEST"), "wt");      termscript = fopen (getenv ("EMACSTEST"), "wt");
2527      
2528  #ifndef HAVE_X_WINDOWS  #ifndef HAVE_X_WINDOWS
2529    if (!internal_terminal || inhibit_window_system)    if (!internal_terminal || inhibit_window_system)
2530      {      {
# Line 2631  dos_get_saved_screen (screen, rows, cols Line 2612  dos_get_saved_screen (screen, rows, cols
2612    return *screen != (char *)0;    return *screen != (char *)0;
2613  #else  #else
2614    return 0;    return 0;
2615  #endif    #endif
2616  }  }
2617    
2618  #ifndef HAVE_X_WINDOWS  #ifndef HAVE_X_WINDOWS
# Line 2801  dos_set_keyboard (code, always) Line 2782  dos_set_keyboard (code, always)
2782    keyboard = keyboard_layout_list[0].keyboard_map;    keyboard = keyboard_layout_list[0].keyboard_map;
2783    keyboard_map_all = always;    keyboard_map_all = always;
2784    dos_keyboard_layout = 1;    dos_keyboard_layout = 1;
2785      
2786    for (i = 0; i < (sizeof (keyboard_layout_list)/sizeof (struct keyboard_layout_list)); i++)    for (i = 0; i < (sizeof (keyboard_layout_list)/sizeof (struct keyboard_layout_list)); i++)
2787      if (code == keyboard_layout_list[i].country_code)      if (code == keyboard_layout_list[i].country_code)
2788        {        {
# Line 2878  ibmpc_translate_map[] = Line 2859  ibmpc_translate_map[] =
2859    Map | 23,                     /* 'o' */    Map | 23,                     /* 'o' */
2860    Map | 24,                     /* 'p' */    Map | 24,                     /* 'p' */
2861    Map | 25,                     /* '[' */    Map | 25,                     /* '[' */
2862    Map | 26,                     /* ']' */    Map | 26,                     /* ']' */
2863    ModFct | 0x0d,                /* Return */    ModFct | 0x0d,                /* Return */
2864    Ignore,                       /* Ctrl */    Ignore,                       /* Ctrl */
2865    Map | 30,                     /* 'a' */    Map | 30,                     /* 'a' */
# Line 3054  dos_get_modifiers (keymask) Line 3035  dos_get_modifiers (keymask)
3035       int *keymask;       int *keymask;
3036  {  {
3037    union REGS regs;    union REGS regs;
3038    int mask;    int mask, modifiers = 0;
3039    int modifiers = 0;  
     
3040    /* Calculate modifier bits */    /* Calculate modifier bits */
3041    regs.h.ah = extended_kbd ? 0x12 : 0x02;    regs.h.ah = extended_kbd ? 0x12 : 0x02;
3042    int86 (0x16, &regs, &regs);    int86 (0x16, &regs, &regs);
3043    
3044    if (!extended_kbd)    if (!extended_kbd)
3045      {      {
3046        mask = regs.h.al & (SHIFT_P | CTRL_P | ALT_P |        mask = regs.h.al & (SHIFT_P | CTRL_P | ALT_P |
3047                            SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);                            SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);
3048      }      }
3049    else    else
3050      {      {
3051        mask = regs.h.al & (SHIFT_P |        mask = regs.h.al & (SHIFT_P |
3052                            SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);                            SCRLOCK_P | NUMLOCK_P | CAPSLOCK_P);
3053      
3054        /* Do not break international keyboard support.   */        /* Do not break international keyboard support.   */
3055        /* When Keyb.Com is loaded, the right Alt key is  */        /* When Keyb.Com is loaded, the right Alt key is  */
3056        /* used for accessing characters like { and }       */        /* used for accessing characters like { and }       */
# Line 3098  dos_get_modifiers (keymask) Line 3078  dos_get_modifiers (keymask)
3078                mask |= ALT_P;                mask |= ALT_P;
3079              }              }
3080          }          }
3081          
3082        if (regs.h.ah & 1)                /* Left CTRL pressed ? */        if (regs.h.ah & 1)                /* Left CTRL pressed ? */
3083          mask |= CTRL_P;          mask |= CTRL_P;
3084    
# Line 3142  Each input key receives two values in th Line 3122  Each input key receives two values in th
3122  and then the scan code.  */)  and then the scan code.  */)
3123       ()       ()
3124  {  {
3125    Lisp_Object *keys = XVECTOR (recent_doskeys)->contents;    Lisp_Object val, *keys = XVECTOR (recent_doskeys)->contents;
   Lisp_Object val;  
3126    
3127    if (total_doskeys < NUM_RECENT_DOSKEYS)    if (total_doskeys < NUM_RECENT_DOSKEYS)
3128      return Fvector (total_doskeys, keys);      return Fvector (total_doskeys, keys);
# Line 3167  dos_rawgetc () Line 3146  dos_rawgetc ()
3146    struct input_event event;    struct input_event event;
3147    union REGS regs;    union REGS regs;
3148    struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME());    struct display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME());
3149      
3150  #ifndef HAVE_X_WINDOWS  #ifndef HAVE_X_WINDOWS
3151    /* Maybe put the cursor where it should be.  */    /* Maybe put the cursor where it should be.  */
3152    IT_cmgoto (SELECTED_FRAME());    IT_cmgoto (SELECTED_FRAME());
# Line 3181  dos_rawgetc () Line 3160  dos_rawgetc ()
3160      {      {
3161        union REGS regs;        union REGS regs;
3162        register unsigned char c;        register unsigned char c;
3163        int sc, code = -1, mask, kp_mode;        int modifiers, sc, code = -1, mask, kp_mode;
       int modifiers;  
3164    
3165        regs.h.ah = extended_kbd ? 0x10 : 0x00;        regs.h.ah = extended_kbd ? 0x10 : 0x00;
3166        int86 (0x16, &regs, &regs);        int86 (0x16, &regs, &regs);
# Line 3200  dos_rawgetc () Line 3178  dos_rawgetc ()
3178          recent_doskeys_index = 0;          recent_doskeys_index = 0;
3179    
3180        modifiers = dos_get_modifiers (&mask);        modifiers = dos_get_modifiers (&mask);
3181          
3182  #ifndef HAVE_X_WINDOWS  #ifndef HAVE_X_WINDOWS
3183        if (!NILP (Vdos_display_scancodes))        if (!NILP (Vdos_display_scancodes))
3184          {          {
# Line 3256  dos_rawgetc () Line 3234  dos_rawgetc ()
3234                  continue;                  continue;
3235              }              }
3236          }          }
3237          
3238        if (c == 0)        if (c == 0)
3239          {          {
3240          /* We only look at the keyboard Ctrl/Shift/Alt keys when          /* We only look at the keyboard Ctrl/Shift/Alt keys when
# Line 3278  dos_rawgetc () Line 3256  dos_rawgetc ()
3256            if (code & Shift)            if (code & Shift)
3257              modifiers |= shift_modifier;              modifiers |= shift_modifier;
3258          }          }
3259          
3260        switch (code & 0xf000)        switch (code & 0xf000)
3261          {          {
3262          case ModFct:          case ModFct:
3263            if (c && !(mask & (SHIFT_P | ALT_P | CTRL_P | HYPER_P | SUPER_P)))            if (c && !(mask & (SHIFT_P | ALT_P | CTRL_P | HYPER_P | SUPER_P)))
3264              return c;              return c;
3265            c = 0;                /* Special */            c = 0;                /* Special */
3266              
3267          case FctKey:          case FctKey:
3268            if (c != 0)            if (c != 0)
3269              return c;              return c;
3270                
3271          case Special:          case Special:
3272            code |= 0xff00;            code |= 0xff00;
3273            break;            break;
3274              
3275          case Normal:          case Normal:
3276            if (sc == 0)            if (sc == 0)
3277              {              {
# Line 3308  dos_rawgetc () Line 3286  dos_rawgetc ()
3286                code = c;                code = c;
3287                break;                break;
3288              }              }
3289              
3290          case Map:          case Map:
3291            if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P)))            if (c && !(mask & ALT_P) && !((mask & SHIFT_P) && (mask & CTRL_P)))
3292              if (!keyboard_map_all)              if (!keyboard_map_all)
# Line 3317  dos_rawgetc () Line 3295  dos_rawgetc ()
3295            code &= 0xff;            code &= 0xff;
3296            if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200)            if (mask & ALT_P && code <= 10 && code > 0 && dos_keypad_mode & 0x200)
3297              mask |= SHIFT_P;    /* ALT-1 => M-! etc. */              mask |= SHIFT_P;    /* ALT-1 => M-! etc. */
3298              
3299            if (mask & SHIFT_P)            if (mask & SHIFT_P)
3300              {              {
3301                code = keyboard->shifted[code];                code = keyboard->shifted[code];
# Line 3340  dos_rawgetc () Line 3318  dos_rawgetc ()
3318                kp_mode = dos_keypad_mode & 0x03;                kp_mode = dos_keypad_mode & 0x03;
3319              else              else
3320                kp_mode = (dos_keypad_mode >> 4) & 0x03;                kp_mode = (dos_keypad_mode >> 4) & 0x03;
3321              
3322            switch (kp_mode)            switch (kp_mode)
3323              {              {
3324              case 0:              case 0:
# Line 3356  dos_rawgetc () Line 3334  dos_rawgetc ()
3334                code = keypad_translate_map[code].meta_code;                code = keypad_translate_map[code].meta_code;
3335                modifiers = meta_modifier;                modifiers = meta_modifier;
3336                break;                break;
3337                  
3338              case 3:              case 3:
3339                code = 0xff00 | keypad_translate_map[code].editkey_code;                code = 0xff00 | keypad_translate_map[code].editkey_code;
3340                break;                break;
3341              }              }
3342            break;            break;
3343              
3344          case Grey:          case Grey:
3345            code &= 0xff;            code &= 0xff;
3346            kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40;            kp_mode = ((mask & (NUMLOCK_P|CTRL_P|SHIFT_P|ALT_P)) == NUMLOCK_P) ? 0x04 : 0x40;
# Line 3372  dos_rawgetc () Line 3350  dos_rawgetc ()
3350              code = grey_key_translate_map[code].char_code;              code = grey_key_translate_map[code].char_code;
3351            break;            break;
3352          }          }
3353          
3354      make_event:      make_event:
3355        if (code == 0)        if (code == 0)
3356          continue;          continue;
# Line 3543  dos_keyread () Line 3521  dos_keyread ()
3521  void  void
3522  pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)  pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
3523       FRAME_PTR f;       FRAME_PTR f;
3524       register int pix_x, pix_y;       register int pix_x, pix_y, *x, *y;
      register int *x, *y;  
3525       XRectangle *bounds;       XRectangle *bounds;
3526       int noclip;       int noclip;
3527  {  {
# Line 3559  pixel_to_glyph_coords (f, pix_x, pix_y, Line 3536  pixel_to_glyph_coords (f, pix_x, pix_y,
3536  void  void
3537  glyph_to_pixel_coords (f, x, y, pix_x, pix_y)  glyph_to_pixel_coords (f, x, y, pix_x, pix_y)
3538       FRAME_PTR f;       FRAME_PTR f;
3539       register int x, y;       register int x, y, *pix_x, *pix_y;
      register int *pix_x, *pix_y;  
3540  {  {
3541    *pix_x = x;    *pix_x = x;
3542    *pix_y = y;    *pix_y = y;
# Line 3664  IT_menu_calc_size (XMenu *menu, int *wid Line 3640  IT_menu_calc_size (XMenu *menu, int *wid
3640  static void  static void
3641  IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)  IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)
3642  {  {
3643    int i, j, face, width;    int i, j, face, width,  mx, my, enabled, mousehere, row, col;
3644    struct glyph *text, *p;    struct glyph *text, *p;
3645    char *q;    char *q;
   int mx, my;  
   int enabled, mousehere;  
   int row, col;  
3646    struct frame *sf = SELECTED_FRAME();    struct frame *sf = SELECTED_FRAME();
3647    
3648    menu_help_message = NULL;    menu_help_message = NULL;
# Line 3738  IT_menu_display (XMenu *menu, int y, int Line 3711  IT_menu_display (XMenu *menu, int y, int
3711  /* Report availability of menus.  */  /* Report availability of menus.  */
3712    
3713  int  int
3714  have_menus_p ()  have_menus_p () {  return 1; }
 {  
   return 1;  
 }  
3715    
3716  /* Create a brand new menu structure.  */  /* Create a brand new menu structure.  */
3717    
# Line 3843  XMenuActivate (Display *foo, XMenu *menu Line 3813  XMenuActivate (Display *foo, XMenu *menu
3813                 void (*help_callback)(char *, int, int))                 void (*help_callback)(char *, int, int))
3814  {  {
3815    struct IT_menu_state *state;    struct IT_menu_state *state;
3816    int statecount;    int statecount, x, y, i, b, screensize, leave, result, onepane;
   int x, y, i, b;  
   int screensize;  
   int faces[4];  
   Lisp_Object selectface;  
   int leave, result, onepane;  
3817    int title_faces[4];           /* face to display the menu title */    int title_faces[4];           /* face to display the menu title */
3818    int buffers_num_deleted = 0;    int faces[4], buffers_num_deleted = 0;
3819    struct frame *sf = SELECTED_FRAME();    struct frame *sf = SELECTED_FRAME();
3820    Lisp_Object saved_echo_area_message;    Lisp_Object saved_echo_area_message, selectface;
3821    
3822    /* Just in case we got here without a mouse present...  */    /* Just in case we got here without a mouse present...  */
3823    if (have_mouse <= 0)    if (have_mouse <= 0)
# Line 3891  XMenuActivate (Display *foo, XMenu *menu Line 3856  XMenuActivate (Display *foo, XMenu *menu
3856    
3857    /* Don't let the title for the "Buffers" popup menu include a    /* Don't let the title for the "Buffers" popup menu include a
3858       digit (which is ugly).       digit (which is ugly).
3859        
3860       This is a terrible kludge, but I think the "Buffers" case is       This is a terrible kludge, but I think the "Buffers" case is
3861       the only one where the title includes a number, so it doesn't       the only one where the title includes a number, so it doesn't
3862       seem to be necessary to make this more general.  */       seem to be necessary to make this more general.  */
# Line 3983  XMenuActivate (Display *foo, XMenu *menu Line 3948  XMenuActivate (Display *foo, XMenu *menu
3948                          state[statecount].x                          state[statecount].x
3949                            = state[i].x + state[i].menu->width + 2;                            = state[i].x + state[i].menu->width + 2;
3950                          state[statecount].y = y;                          state[statecount].y = y;
3951                          statecount++;                                              statecount++;
3952                        }                        }
3953                    }                    }
3954                }                }
# Line 4144  getdefdir (drive, dst) Line 4109  getdefdir (drive, dst)
4109       int drive;       int drive;
4110       char *dst;       char *dst;
4111  {  {
4112    char in_path[4], *p = in_path;    char in_path[4], *p = in_path, e = errno;;
   int e = errno;  
4113    
4114    /* Generate "X:." (when drive is X) or "." (when drive is 0).  */    /* Generate "X:." (when drive is X) or "." (when drive is 0).  */
4115    if (drive != 0)    if (drive != 0)
# Line 4186  crlf_to_lf (n, buf) Line 4150  crlf_to_lf (n, buf)
4150       register int n;       register int n;
4151       register unsigned char *buf;       register unsigned char *buf;
4152  {  {
4153    unsigned char *np = buf;    unsigned char *np = buf, *startp = buf, *endp = buf + n;
   unsigned char *startp = buf;  
   unsigned char *endp = buf + n;  
4154    
4155    if (n == 0)    if (n == 0)
4156      return n;      return n;
# Line 4283  __write (int handle, const void *buffer, Line 4245  __write (int handle, const void *buffer,
4245     used when you compile with DJGPP v2.0.  */     used when you compile with DJGPP v2.0.  */
4246    
4247  #include <io.h>  #include <io.h>
4248    
4249  int _rename(const char *old, const char *new)  int _rename(const char *old, const char *new)
4250  {  {
4251    __dpmi_regs r;    __dpmi_regs r;
# Line 4474  init_environment (argc, argv, skip_args) Line 4436  init_environment (argc, argv, skip_args)
4436       int skip_args;       int skip_args;
4437  {  {
4438    char *s, *t, *root;    char *s, *t, *root;
4439    int len;    int len, i;
4440    static const char * const tempdirs[] = {    static const char * const tempdirs[] = {
4441      "$TMPDIR", "$TEMP", "$TMP", "c:/"      "$TMPDIR", "$TEMP", "$TMP", "c:/"
4442    };    };
   int i;  
4443    const int imax = sizeof (tempdirs) / sizeof (tempdirs[0]);    const int imax = sizeof (tempdirs) / sizeof (tempdirs[0]);
4444    
4445    /* Make sure they have a usable $TMPDIR.  Many Emacs functions use    /* Make sure they have a usable $TMPDIR.  Many Emacs functions use
# Line 4664  dos_ttraw () Line 4625  dos_ttraw ()
4625  {  {
4626    union REGS inregs, outregs;    union REGS inregs, outregs;
4627    static int first_time = 1;    static int first_time = 1;
4628      
4629    break_stat = getcbrk ();    break_stat = getcbrk ();
4630    setcbrk (0);    setcbrk (0);
4631  #if __DJGPP__ < 2  #if __DJGPP__ < 2
# Line 4676  dos_ttraw () Line 4637  dos_ttraw ()
4637        inregs.h.ah = 0xc0;        inregs.h.ah = 0xc0;
4638        int86 (0x15, &inregs, &outregs);        int86 (0x15, &inregs, &outregs);
4639        extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0);        extended_kbd = (!outregs.x.cflag) && (outregs.h.ah == 0);
4640      
4641        have_mouse = 0;        have_mouse = 0;
4642    
4643        if (internal_terminal        if (internal_terminal
# Line 4795  run_msdos_command (argv, working_dir, te Line 4756  run_msdos_command (argv, working_dir, te
4756  {  {
4757    char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl;    char *saveargv1, *saveargv2, *lowcase_argv0, *pa, *pl;
4758    char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS.  */    char oldwd[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS.  */
4759    int msshell, result = -1;    int msshell, result = -1, inbak, outbak, errbak, x, y;
   int inbak, outbak, errbak;  
   int x, y;  
4760    Lisp_Object cmd;    Lisp_Object cmd;
4761    
4762    /* Get current directory as MSDOS cwd is not per-process.  */    /* Get current directory as MSDOS cwd is not per-process.  */
# Line 4854  run_msdos_command (argv, working_dir, te Line 4813  run_msdos_command (argv, working_dir, te
4813      mouse_get_xy (&x, &y);      mouse_get_xy (&x, &y);
4814    
4815    dos_ttcooked ();      /* do it here while 0 = stdin */    dos_ttcooked ();      /* do it here while 0 = stdin */
4816      
4817    dup2 (tempin, 0);    dup2 (tempin, 0);
4818    dup2 (tempout, 1);    dup2 (tempout, 1);
4819    dup2 (temperr, 2);    dup2 (temperr, 2);
# Line 4905  run_msdos_command (argv, working_dir, te Line 4864  run_msdos_command (argv, working_dir, te
4864  #endif /* __DJGPP__ > 1 */  #endif /* __DJGPP__ > 1 */
4865    
4866    result = spawnve (P_WAIT, argv[0], argv, envv);    result = spawnve (P_WAIT, argv[0], argv, envv);
4867      
4868    dup2 (inbak, 0);    dup2 (inbak, 0);
4869    dup2 (outbak, 1);    dup2 (outbak, 1);
4870    dup2 (errbak, 2);    dup2 (errbak, 2);
# Line 4924  run_msdos_command (argv, working_dir, te Line 4883  run_msdos_command (argv, working_dir, te
4883       text attribute byte, so we get blinking characters instead of the       text attribute byte, so we get blinking characters instead of the
4884       bright background colors.  Restore that.  */       bright background colors.  Restore that.  */
4885    bright_bg ();    bright_bg ();
4886      
4887   done:   done:
4888    chdir (oldwd);    chdir (oldwd);
4889    if (msshell)    if (msshell)
# Line 4979  gettimeofday (struct timeval *tp, struct Line 4938  gettimeofday (struct timeval *tp, struct
4938      {      {
4939        struct time t;        struct time t;
4940        struct tm tm;        struct tm tm;
4941          
4942        gettime (&t);        gettime (&t);
4943        if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */        if (t.ti_hour < time_rec.tm_hour) /* midnight wrap */
4944          {          {
# Line 4989  gettimeofday (struct timeval *tp, struct Line 4948  gettimeofday (struct timeval *tp, struct
4948            time_rec.tm_mon = d.da_mon - 1;            time_rec.tm_mon = d.da_mon - 1;
4949            time_rec.tm_mday = d.da_day;            time_rec.tm_mday = d.da_day;
4950          }          }
4951          
4952        time_rec.tm_hour = t.ti_hour;        time_rec.tm_hour = t.ti_hour;
4953        time_rec.tm_min = t.ti_min;        time_rec.tm_min = t.ti_min;
4954        time_rec.tm_sec = t.ti_sec;        time_rec.tm_sec = t.ti_sec;
4955    
4956        tm = time_rec;        tm = time_rec;
4957        tm.tm_gmtoff = dos_timezone_offset;        tm.tm_gmtoff = dos_timezone_offset;
4958          
4959        tp->tv_sec = mktime (&tm);        /* may modify tm */        tp->tv_sec = mktime (&tm);        /* may modify tm */
4960        tp->tv_usec = t.ti_hund * (1000000 / 100);        tp->tv_usec = t.ti_hund * (1000000 / 100);
4961      }      }
# Line 5017  int kill (x, y) int x, y; { return -1; } Line 4976  int kill (x, y) int x, y; { return -1; }
4976  nice (p) int p; {}  nice (p) int p; {}
4977  void volatile pause () {}  void volatile pause () {}
4978  sigsetmask (x) int x; { return 0; }  sigsetmask (x) int x; { return 0; }
4979  sigblock (mask) int mask; { return 0; }  sigblock (mask) int mask; { return 0; }
4980  #endif  #endif
4981    
4982  void request_sigio (void) {}  void request_sigio (void) {}
# Line 5026  setpriority (x,y,z) int x,y,z; { return Line 4985  setpriority (x,y,z) int x,y,z; { return
4985  void unrequest_sigio (void) {}  void unrequest_sigio (void) {}
4986    
4987  #if __DJGPP__ > 1  #if __DJGPP__ > 1
4988    #if __DJGPP_MINOR__ < 2
4989    
4990  #ifdef POSIX_SIGNALS  #ifdef POSIX_SIGNALS
4991    
# Line 5132  sigsetmask (x) int x; { return 0; } Line 5092  sigsetmask (x) int x; { return 0; }
5092  sigblock (mask) int mask; { return 0; }  sigblock (mask) int mask; { return 0; }
5093    
5094  #endif /* not POSIX_SIGNALS */  #endif /* not POSIX_SIGNALS */
5095    #endif /* not __DJGPP_MINOR__ < 2 */
5096  #endif /* __DJGPP__ > 1 */  #endif /* __DJGPP__ > 1 */
5097    
5098  #ifndef HAVE_SELECT  #ifndef HAVE_SELECT
# Line 5189  sys_select (nfds, rfds, wfds, efds, time Line 5150  sys_select (nfds, rfds, wfds, efds, time
5150    
5151    if (nfds != 1)    if (nfds != 1)
5152      abort ();      abort ();
5153      
5154    /* If we are looking only for the terminal, with no timeout,    /* If we are looking only for the terminal, with no timeout,
5155       just read it and wait -- that's more efficient.  */       just read it and wait -- that's more efficient.  */
5156    if (!timeout)    if (!timeout)
# Line 5225  sys_select (nfds, rfds, wfds, efds, time Line 5186  sys_select (nfds, rfds, wfds, efds, time
5186            dos_yield_time_slice ();            dos_yield_time_slice ();
5187          }          }
5188      }      }
5189      
5190    FD_SET (0, rfds);    FD_SET (0, rfds);
5191    return 1;    return 1;
5192  }  }
# Line 5257  sys_chdir (path) Line 5218  sys_chdir (path)
5218        tmp += 2; /* strip drive: KFS 1995-07-06 */        tmp += 2; /* strip drive: KFS 1995-07-06 */
5219        len -= 2;        len -= 2;
5220      }      }
5221      
5222    if (len > 1 && (tmp[len - 1] == '/'))    if (len > 1 && (tmp[len - 1] == '/'))
5223      {      {
5224        char *tmp1 = (char *) alloca (len + 1);        char *tmp1 = (char *) alloca (len + 1);
# Line 5298  dos_abort (file, line) Line 5259  dos_abort (file, line)
5259  {  {
5260    char buffer1[200], buffer2[400];    char buffer1[200], buffer2[400];
5261    int i, j;    int i, j;
5262      
5263    sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line);    sprintf (buffer1, "<EMACS FATAL ERROR IN %s LINE %d>", file, line);
5264    for (i = j = 0; buffer1[i]; i++) {    for (i = j = 0; buffer1[i]; i++) {
5265      buffer2[j++] = buffer1[i];      buffer2[j++] = buffer1[i];
# Line 5387  nil means don't delete them until `list- Line 5348  nil means don't delete them until `list-
5348  }  }
5349    
5350  #endif /* MSDOS */  #endif /* MSDOS */
   

Legend:
Removed from v.1.172  
changed lines
  Added in v.1.173

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26