* m/template.h:
[bpt/emacs.git] / src / msdos.c
index fd4f211..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 */
@@ -56,7 +55,7 @@ Boston, MA 02110-1301, USA.  */
 #include "dispextern.h"
 #include "dosfns.h"
 #include "termopts.h"
-#include "charset.h"
+#include "character.h"
 #include "coding.h"
 #include "disptab.h"
 #include "frame.h"
@@ -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))
@@ -3231,7 +3229,7 @@ dos_rawgetc ()
            `dos_get_modifiers', they might have already released the
            Alt key, and Emacs gets just `x', which is BAD.
            However, for keys with the `Map' property set, the ASCII
-           code returns zero iff Alt is pressed.  So, when we DON'T
+           code returns zero only if Alt is pressed.  So, when we DON'T
            have to support international_keyboard, we don't have to
            distinguish between the left and  right Alt keys, and we
            can set the META modifier for any keys with the `Map'
@@ -3799,15 +3797,15 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx,
   screensize = screen_size * 2;
   faces[0]
     = lookup_derived_face (sf, intern ("msdos-menu-passive-face"),
-                          0, DEFAULT_FACE_ID, 1);
+                          DEFAULT_FACE_ID, 1);
   faces[1]
     = lookup_derived_face (sf, intern ("msdos-menu-active-face"),
-                          0, DEFAULT_FACE_ID, 1);
+                          DEFAULT_FACE_ID, 1);
   selectface = intern ("msdos-menu-select-face");
   faces[2] = lookup_derived_face (sf, selectface,
-                                 0, faces[0], 1);
+                                 faces[0], 1);
   faces[3] = lookup_derived_face (sf, selectface,
-                                 0, faces[1], 1);
+                                 faces[1], 1);
 
   /* Make sure the menu title is always displayed with
      `msdos-menu-active-face', no matter where the mouse pointer is.  */