Undo the DEFUN->DEFUE change.
[bpt/emacs.git] / src / fontset.c
index c38b01d..a40a3dd 100644 (file)
@@ -1,13 +1,13 @@
 /* Fontset handler.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-     Free Software Foundation, Inc.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-     2005, 2006, 2007, 2008, 2009, 2010, 2011
-     National Institute of Advanced Industrial Science and Technology (AIST)
-     Registration Number H14PRO021
-   Copyright (C) 2003, 2006
-     National Institute of Advanced Industrial Science and Technology (AIST)
-     Registration Number H13PRO009
+
+Copyright (C) 2001-2011  Free Software Foundation, Inc.
+Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+  2005, 2006, 2007, 2008, 2009, 2010, 2011
+  National Institute of Advanced Industrial Science and Technology (AIST)
+  Registration Number H14PRO021
+Copyright (C) 2003, 2006
+  National Institute of Advanced Industrial Science and Technology (AIST)
+  Registration Number H13PRO009
 
 This file is part of GNU Emacs.
 
@@ -191,14 +191,6 @@ static int next_fontset_id;
    font for each character.  */
 static Lisp_Object Vdefault_fontset;
 
-Lisp_Object Vfont_encoding_charset_alist;
-Lisp_Object Vuse_default_ascent;
-Lisp_Object Vignore_relative_composition;
-Lisp_Object Valternate_fontname_alist;
-Lisp_Object Vfontset_alias_alist;
-Lisp_Object Vvertical_centering_font_regexp;
-Lisp_Object Votf_script_alist;
-
 /* Check if any window system is used now.  */
 void (*check_window_system_func) (void);
 
@@ -241,14 +233,14 @@ fontset_id_valid_p (int id)
 /* Macros to access special values of (base) FONTSET.  */
 #define FONTSET_NAME(fontset)          XCHAR_TABLE (fontset)->extras[1]
 #define FONTSET_ASCII(fontset)         XCHAR_TABLE (fontset)->extras[4]
-#define FONTSET_SPEC(fontset)          XCHAR_TABLE (fontset)->extras[5]
+/* #define FONTSET_SPEC(fontset)       XCHAR_TABLE (fontset)->extras[5] */
 
 /* Macros to access special values of (realized) FONTSET.  */
 #define FONTSET_BASE(fontset)          XCHAR_TABLE (fontset)->extras[2]
 #define FONTSET_FRAME(fontset)         XCHAR_TABLE (fontset)->extras[3]
-#define FONTSET_OBJLIST(fontset)       XCHAR_TABLE (fontset)->extras[4]
+/* #define FONTSET_OBJLIST(fontset)    XCHAR_TABLE (fontset)->extras[4] */
 #define FONTSET_NOFONT_FACE(fontset)   XCHAR_TABLE (fontset)->extras[5]
-#define FONTSET_REPERTORY(fontset)     XCHAR_TABLE (fontset)->extras[6]
+/* #define FONTSET_REPERTORY(fontset)  XCHAR_TABLE (fontset)->extras[6] */
 #define FONTSET_DEFAULT(fontset)       XCHAR_TABLE (fontset)->extras[7]
 
 /* For both base and realized fontset.  */
@@ -274,7 +266,6 @@ fontset_id_valid_p (int id)
   ASET ((rfont_def), 0, make_number (face_id))
 #define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1)
 #define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1))
-#define RFONT_DEF_REPERTORY(rfont_def) FONT_DEF_REPERTORY (AREF (rfont_def, 1))
 #define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2)
 #define RFONT_DEF_SET_OBJECT(rfont_def, object)        \
   ASET ((rfont_def), 2, (object))
@@ -721,7 +712,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa
 static Lisp_Object
 fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
 {
-  Lisp_Object rfont_def, default_rfont_def;
+  Lisp_Object rfont_def, default_rfont_def IF_LINT (= Qnil);
   Lisp_Object base_fontset;
 
   /* Try a font-group of FONTSET. */
@@ -844,17 +835,19 @@ fontset_ascii (int id)
   return elt;
 }
 
-void
+static void
 free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
 {
+#if 0
   Lisp_Object tail;
 
-  return;
-  for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
-    {
-      xassert (FONT_OBJECT_P (XCAR (tail)));
-      font_close_object (f, XCAR (tail));
-    }
+  if (0)
+    for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
+      {
+       xassert (FONT_OBJECT_P (XCAR (tail)));
+       font_close_object (f, XCAR (tail));
+      }
+#endif
 }
 
 /* Free fontset of FACE defined on frame F.  Called from
@@ -890,6 +883,7 @@ free_face_fontset (FRAME_PTR f, struct face *face)
 }
 
 
+#if 0
 /* Return 1 if FACE is suitable for displaying character C.
    Otherwise return 0.  Called from the macro FACE_SUITABLE_FOR_CHAR_P
    when C is not an ASCII character.  */
@@ -905,6 +899,7 @@ face_suitable_for_char_p (struct face *face, int c)
          && INTEGERP (RFONT_DEF_FACE (rfont_def))
          && face->id == XINT (RFONT_DEF_FACE (rfont_def)));
 }
+#endif
 
 
 /* Return ID of face suitable for displaying character C on frame F.
@@ -1057,7 +1052,7 @@ make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face
    the corresponding regular expression.  */
 static Lisp_Object Vcached_fontset_data;
 
-#define CACHED_FONTSET_NAME ((char *) SDATA (XCAR (Vcached_fontset_data)))
+#define CACHED_FONTSET_NAME SSDATA (XCAR (Vcached_fontset_data))
 #define CACHED_FONTSET_REGEX (XCDR (Vcached_fontset_data))
 
 /* If fontset name PATTERN contains any wild card, return regular
@@ -1066,13 +1061,13 @@ static Lisp_Object Vcached_fontset_data;
 static Lisp_Object
 fontset_pattern_regexp (Lisp_Object pattern)
 {
-  if (!strchr ((char *) SDATA (pattern), '*')
-      && !strchr ((char *) SDATA (pattern), '?'))
+  if (!strchr (SSDATA (pattern), '*')
+      && !strchr (SSDATA (pattern), '?'))
     /* PATTERN does not contain any wild cards.  */
     return Qnil;
 
   if (!CONSP (Vcached_fontset_data)
-      || strcmp ((char *) SDATA (pattern), CACHED_FONTSET_NAME))
+      || strcmp (SSDATA (pattern), CACHED_FONTSET_NAME))
     {
       /* We must at first update the cached data.  */
       unsigned char *regex, *p0, *p1;
@@ -1123,7 +1118,7 @@ fontset_pattern_regexp (Lisp_Object pattern)
       *p1++ = '$';
       *p1++ = 0;
 
-      Vcached_fontset_data = Fcons (build_string ((char *) SDATA (pattern)),
+      Vcached_fontset_data = Fcons (build_string (SSDATA (pattern)),
                                    build_string ((char *) regex));
     }
 
@@ -1174,7 +1169,7 @@ fs_query_fontset (Lisp_Object name, int name_pattern)
       this_name = FONTSET_NAME (fontset);
       if (name_pattern == 1
          ? fast_string_match_ignore_case (name, this_name) >= 0
-         : !xstrcasecmp (SDATA (name), SDATA (this_name)))
+         : !xstrcasecmp (SSDATA (name), SSDATA (this_name)))
        return i;
     }
   return -1;
@@ -1233,7 +1228,7 @@ list_fontsets (FRAME_PTR f, Lisp_Object pattern, int size)
 
       if (STRINGP (regexp)
          ? (fast_string_match (regexp, name) < 0)
-         : strcmp ((char *) SDATA (pattern), (char *) SDATA (name)))
+         : strcmp (SSDATA (pattern), SSDATA (name)))
        continue;
 
       val = Fcons (Fcopy_sequence (FONTSET_NAME (fontset)), val);
@@ -1591,14 +1586,14 @@ appended.  By default, FONT-SPEC overrides the previous settings.  */)
 
   if (ascii_changed)
     {
-      Lisp_Object tail, frame, alist;
+      Lisp_Object tail, fr, alist;
       int fontset_id = XINT (FONTSET_ID (fontset));
 
       FONTSET_ASCII (fontset) = fontname;
       name = FONTSET_NAME (fontset);
-      FOR_EACH_FRAME (tail, frame)
+      FOR_EACH_FRAME (tail, fr)
        {
-         FRAME_PTR f = XFRAME (frame);
+         FRAME_PTR f = XFRAME (fr);
          Lisp_Object font_object;
          struct face *face;
 
@@ -1615,7 +1610,7 @@ appended.  By default, FONT-SPEC overrides the previous settings.  */)
            {
              update_auto_fontset_alist (font_object, fontset);
              alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil);
-             Fmodify_frame_parameters (frame, alist);
+             Fmodify_frame_parameters (fr, alist);
            }
        }
     }
@@ -1659,10 +1654,10 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
       char xlfd[256];
       int len;
 
-      if (font_parse_xlfd ((char *) SDATA (name), font_spec) < 0)
+      if (font_parse_xlfd (SSDATA (name), font_spec) < 0)
        error ("Fontset name must be in XLFD format");
       short_name = AREF (font_spec, FONT_REGISTRY_INDEX);
-      if (strncmp ((char *) SDATA (SYMBOL_NAME (short_name)), "fontset-", 8)
+      if (strncmp (SSDATA (SYMBOL_NAME (short_name)), "fontset-", 8)
          || SBYTES (SYMBOL_NAME (short_name)) < 9)
        error ("Registry field of fontset name must be \"fontset-*\"");
       Vfontset_alias_alist = Fcons (Fcons (name, SYMBOL_NAME (short_name)),
@@ -1718,7 +1713,7 @@ int
 fontset_from_font (Lisp_Object font_object)
 {
   Lisp_Object font_name = font_get_name (font_object);
-  Lisp_Object font_spec = Fcopy_font_spec (font_object);
+  Lisp_Object font_spec = copy_font_spec (font_object);
   Lisp_Object registry = AREF (font_spec, FONT_REGISTRY_INDEX);
   Lisp_Object fontset_spec, alias, name, fontset;
   Lisp_Object val;
@@ -1735,7 +1730,7 @@ fontset_from_font (Lisp_Object font_object)
       sprintf (temp, "fontset-auto%d", num_auto_fontsets - 1);
       alias = intern (temp);
     }
-  fontset_spec = Fcopy_font_spec (font_spec);
+  fontset_spec = copy_font_spec (font_spec);
   ASET (fontset_spec, FONT_REGISTRY_INDEX, alias);
   name = Ffont_xlfd_name (fontset_spec, Qnil);
   if (NILP (name))
@@ -1824,7 +1819,6 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
   int c;
   struct frame *f;
   struct face *face;
-  int cs_id;
 
   if (NILP (position))
     {
@@ -1833,11 +1827,10 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
       f = XFRAME (selected_frame);
       face_id = lookup_basic_face (f, DEFAULT_FACE_ID);
       pos = -1;
-      cs_id = -1;
     }
   else
     {
-      Lisp_Object window, charset;
+      Lisp_Object window;
       struct window *w;
 
       CHECK_NUMBER_COERCE_MARKER (position);
@@ -1859,11 +1852,6 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
       f = XFRAME (w->frame);
       face_id = face_at_buffer_position (w, pos, -1, -1, &dummy,
                                         pos + 100, 0, -1);
-      charset = Fget_char_property (position, Qcharset, Qnil);
-      if (CHARSETP (charset))
-       cs_id = XINT (CHARSET_SYMBOL_ID (charset));
-      else
-       cs_id = -1;
     }
   if (! CHAR_VALID_P (c, 0))
     return Qnil;
@@ -1909,7 +1897,6 @@ information about the derived fonts from the default fontset.  The
 format is the same as above.  */)
   (Lisp_Object fontset, Lisp_Object frame)
 {
-  FRAME_PTR f;
   Lisp_Object *realized[2], fontsets[2], tables[2];
   Lisp_Object val, elt;
   int c, i, j, k;
@@ -1917,7 +1904,6 @@ format is the same as above.  */)
   (*check_window_system_func) ();
 
   fontset = check_fontset_name (fontset, &frame);
-  f = XFRAME (frame);
 
   /* Recode fontsets realized on FRAME from the base fontset FONTSET
      in the table `realized'.  */
@@ -2199,7 +2185,7 @@ syms_of_fontset (void)
   auto_fontset_alist = Qnil;
   staticpro (&auto_fontset_alist);
 
-  DEFVAR_LISP ("font-encoding-charset-alist", &Vfont_encoding_charset_alist,
+  DEFVAR_LISP ("font-encoding-charset-alist", Vfont_encoding_charset_alist,
               doc: /*
 Alist of charsets vs the charsets to determine the preferred font encoding.
 Each element looks like (CHARSET . ENCODING-CHARSET),
@@ -2210,7 +2196,7 @@ When a text has a property `charset' and the value is CHARSET, a font
 whose encoding corresponds to ENCODING-CHARSET is preferred.  */);
   Vfont_encoding_charset_alist = Qnil;
 
-  DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
+  DEFVAR_LISP ("use-default-ascent", Vuse_default_ascent,
               doc: /*
 Char table of characters whose ascent values should be ignored.
 If an entry for a character is non-nil, the ascent value of the glyph
@@ -2220,7 +2206,7 @@ This affects how a composite character which contains
 such a character is displayed on screen.  */);
   Vuse_default_ascent = Qnil;
 
-  DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
+  DEFVAR_LISP ("ignore-relative-composition", Vignore_relative_composition,
               doc: /*
 Char table of characters which are not composed relatively.
 If an entry for a character is non-nil, a composition sequence
@@ -2229,26 +2215,26 @@ the glyph of that character is put without considering
 an ascent and descent value of a previous character.  */);
   Vignore_relative_composition = Qnil;
 
-  DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist,
+  DEFVAR_LISP ("alternate-fontname-alist", Valternate_fontname_alist,
               doc: /* Alist of fontname vs list of the alternate fontnames.
 When a specified font name is not found, the corresponding
 alternate fontnames (if any) are tried instead.  */);
   Valternate_fontname_alist = Qnil;
 
-  DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist,
+  DEFVAR_LISP ("fontset-alias-alist", Vfontset_alias_alist,
               doc: /* Alist of fontset names vs the aliases.  */);
   Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
                                       make_pure_c_string ("fontset-default")),
                                Qnil);
 
   DEFVAR_LISP ("vertical-centering-font-regexp",
-              &Vvertical_centering_font_regexp,
+              Vvertical_centering_font_regexp,
               doc: /* *Regexp matching font names that require vertical centering on display.
 When a character is displayed with such fonts, the character is displayed
 at the vertical center of lines.  */);
   Vvertical_centering_font_regexp = Qnil;
 
-  DEFVAR_LISP ("otf-script-alist", &Votf_script_alist,
+  DEFVAR_LISP ("otf-script-alist", Votf_script_alist,
               doc: /* Alist of OpenType script tags vs the corresponding script names.  */);
   Votf_script_alist = Qnil;
 
@@ -2263,4 +2249,3 @@ at the vertical center of lines.  */);
   defsubr (&Sfontset_list_all);
 #endif
 }
-