* m/template.h:
[bpt/emacs.git] / src / msdos.c
index c01755b..b387717 100644 (file)
@@ -1,13 +1,14 @@
 /* MS-DOS specific C utilities.          -*- coding: raw-text -*-
    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
-                 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+                 2003, 2004, 2005, 2006, 2007, 2008
+                 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,9 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Contributed by Morten Welinder */
 /* New display, keyboard, and mouse control by Kim F. Storm */
@@ -508,8 +507,8 @@ ScreenVisualBell (void)
 {
   /* This creates an xor-mask that will swap the default fore- and
      background colors.  */
-  do_visible_bell (((the_only_x_display.foreground_pixel
-                    ^ the_only_x_display.background_pixel)
+  do_visible_bell (((FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ())
+                    ^ FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()))
                    * 0x11) & 0x7f);
 }
 #endif
@@ -986,8 +985,8 @@ IT_write_glyphs (struct glyph *str, int str_len)
   /* Set up the unsupported character glyph */
   if (!NILP (Vdos_unsupported_char_glyph))
     {
-      unsupported_char = FAST_GLYPH_CHAR (XINT (Vdos_unsupported_char_glyph));
-      unsupported_face = FAST_GLYPH_FACE (XINT (Vdos_unsupported_char_glyph));
+      unsupported_char = GLYPH_CHAR (XINT (Vdos_unsupported_char_glyph));
+      unsupported_face = GLYPH_FACE (XINT (Vdos_unsupported_char_glyph));
     }
 
   screen_buf = screen_bp = alloca (str_len * 2);
@@ -1020,13 +1019,12 @@ IT_write_glyphs (struct glyph *str, int str_len)
        }
       else
        {
-         register GLYPH g = GLYPH_FROM_CHAR_GLYPH (*str);
+         GLYPH g;
          int glyph_not_in_table = 0;
 
-         /* If g is negative, it means we have a multibyte character
-            in *str.  That's what GLYPH_FROM_CHAR_GLYPH returns for
-            multibyte characters.  */
-         if (g < 0 || g >= tlen)
+         SET_GLYPH_FROM_CHAR_GLYPH (g, *str);
+
+         if (GLYPH_INVALID_P (g) || GLYPH_SIMPLE_P (tbase, tlen, g))
            {
              /* This glyph doesn't have an entry in Vglyph_table.  */
              ch = str->u.ch;
@@ -1037,7 +1035,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
              /* This glyph has an entry in Vglyph_table, so process
                 any aliases before testing for simpleness.  */
              GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
-             ch = FAST_GLYPH_CHAR (g);
+             ch = GLYPH_CHAR (g);
            }
 
          /* Convert the character code to multibyte, if they
@@ -1053,10 +1051,10 @@ IT_write_glyphs (struct glyph *str, int str_len)
          /* Invalid characters are displayed with a special glyph.  */
          if (! CHAR_VALID_P (ch, 0))
            {
-             g = !NILP (Vdos_unsupported_char_glyph)
+             ch = !NILP (Vdos_unsupported_char_glyph)
                ? XINT (Vdos_unsupported_char_glyph)
-               : MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g));
-             ch = FAST_GLYPH_CHAR (g);
+               : '\177';
+             SET_GLYPH_CHAR (g, ch);
            }
 
          /* If the face of this glyph is different from the current
@@ -1644,7 +1642,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
                /* Find the range of text around this char that
                   should be active.  */
                Lisp_Object before, after;
-               int ignore;
+               EMACS_INT ignore;
 
                before = Foverlay_start (overlay);
                after = Foverlay_end (overlay);
@@ -1671,7 +1669,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
                /* Find the range of text around this char that
                   should be active.  */
                Lisp_Object before, after, beginning, end;
-               int ignore;
+               EMACS_INT ignore;
 
                beginning = Fmarker_position (w->start);
                XSETINT (end, (BUF_Z (XBUFFER (w->buffer))
@@ -2531,8 +2529,8 @@ internal_terminal_init ()
   initial_screen_colors[0] = initial_screen_colors[1] = -1;
 
   bzero (&the_only_x_display, sizeof the_only_x_display);
-  the_only_x_display.background_pixel = 7; /* White */
-  the_only_x_display.foreground_pixel = 0; /* Black */
+  FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = 7; /* White */
+  FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ()) = 0; /* Black */
   bright_bg ();
   colors = getenv ("EMACSCOLORS");
   if (colors && strlen (colors) >= 2)
@@ -2543,13 +2541,13 @@ internal_terminal_init ()
       else if (isxdigit (colors[0]))
         colors[0] -= (isupper (colors[0]) ? 'A' : 'a') - 10;
       if (colors[0] >= 0 && colors[0] < 16)
-        the_only_x_display.foreground_pixel = colors[0];
+        FRAME_FOREGROUND_PIXEL (SELECTED_FRAME ()) = colors[0];
       if (isdigit (colors[1]))
         colors[1] -= '0';
       else if (isxdigit (colors[1]))
         colors[1] -= (isupper (colors[1]) ? 'A' : 'a') - 10;
       if (colors[1] >= 0 && colors[1] < 16)
-        the_only_x_display.background_pixel = colors[1];
+        FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
     }
   the_only_x_display.font = (XFontStruct *)1;   /* must *not* be zero */
   the_only_x_display.display_info.mouse_face_mouse_frame = NULL;
@@ -2583,7 +2581,7 @@ internal_terminal_init ()
   set_terminal_modes_hook = IT_set_terminal_modes;
   reset_terminal_modes_hook = IT_reset_terminal_modes;
   set_terminal_window_hook = IT_set_terminal_window;
-  char_ins_del_ok = 0;
+  TTY_CHAR_INS_DEL_OK (CURTTY ()) = 0;
 #endif
 }
 
@@ -4880,7 +4878,7 @@ croak (badfunc)
      char *badfunc;
 {
   fprintf (stderr, "%s not yet implemented\r\n", badfunc);
-  reset_sys_modes ();
+  reset_all_sys_modes ();
   exit (1);
 }
 \f