emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/fontset.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/fontset.c
Date: Sun, 07 Nov 2004 19:44:37 -0500

Index: emacs/src/fontset.c
diff -c emacs/src/fontset.c:1.91 emacs/src/fontset.c:1.92
*** emacs/src/fontset.c:1.91    Thu Nov  4 23:12:33 2004
--- emacs/src/fontset.c Mon Nov  8 00:38:26 2004
***************
*** 796,802 ****
        {
          if (*p0 == '-')
            ndashes++;
!         else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
            nstars++;
        }
  
--- 796,802 ----
        {
          if (*p0 == '-')
            ndashes++;
!         else if (*p0 == '*')
            nstars++;
        }
  
***************
*** 811,817 ****
        *p1++ = '^';
        for (p0 = SDATA (pattern); *p0; p0++)
        {
!         if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\')
            {
              if (ndashes < 14)
                *p1++ = '.';
--- 811,817 ----
        *p1++ = '^';
        for (p0 = SDATA (pattern); *p0; p0++)
        {
!         if (*p0 == '*')
            {
              if (ndashes < 14)
                *p1++ = '.';
***************
*** 835,863 ****
  }
  
  /* Return ID of the base fontset named NAME.  If there's no such
!    fontset, return -1.  */
  
  int
! fs_query_fontset (name, regexpp)
       Lisp_Object name;
!      int regexpp;
  {
    Lisp_Object tem;
    int i;
  
    name = Fdowncase (name);
!   if (!regexpp)
      {
        tem = Frassoc (name, Vfontset_alias_alist);
        if (CONSP (tem) && STRINGP (XCAR (tem)))
        name = XCAR (tem);
!       else
        {
          tem = fontset_pattern_regexp (name);
          if (STRINGP (tem))
            {
              name = tem;
!             regexpp = 1;
            }
        }
      }
--- 835,867 ----
  }
  
  /* Return ID of the base fontset named NAME.  If there's no such
!    fontset, return -1.  NAME_PATTERN specifies how to treat NAME as this:
!      0: pattern containing '*' and '?' as wildcards
!      1: regular expression
!      2: literal fontset name
! */
  
  int
! fs_query_fontset (name, name_pattern)
       Lisp_Object name;
!      int name_pattern;
  {
    Lisp_Object tem;
    int i;
  
    name = Fdowncase (name);
!   if (name_pattern != 1)
      {
        tem = Frassoc (name, Vfontset_alias_alist);
        if (CONSP (tem) && STRINGP (XCAR (tem)))
        name = XCAR (tem);
!       else if (name_pattern == 0)
        {
          tem = fontset_pattern_regexp (name);
          if (STRINGP (tem))
            {
              name = tem;
!             name_pattern = 1;
            }
        }
      }
***************
*** 872,878 ****
        continue;
  
        this_name = FONTSET_NAME (fontset);
!       if (regexpp
          ? fast_string_match (name, this_name) >= 0
          : !strcmp (SDATA (name), SDATA (this_name)))
        return i;
--- 876,882 ----
        continue;
  
        this_name = FONTSET_NAME (fontset);
!       if (name_pattern == 1
          ? fast_string_match (name, this_name) >= 0
          : !strcmp (SDATA (name), SDATA (this_name)))
        return i;
***************
*** 963,968 ****
--- 967,973 ----
  {
    Lisp_Object fontset, elements, ascii_font;
    Lisp_Object tem, tail, elt;
+   int id;
  
    (*check_window_system_func) ();
  
***************
*** 970,979 ****
    CHECK_LIST (fontlist);
  
    name = Fdowncase (name);
!   tem = Fquery_fontset (name, Qnil);
!   if (!NILP (tem))
!     error ("Fontset `%s' matches the existing fontset `%s'",
!          SDATA (name), SDATA (tem));
  
    /* Check the validity of FONTLIST while creating a template for
       fontset elements.  */
--- 975,988 ----
    CHECK_LIST (fontlist);
  
    name = Fdowncase (name);
!   id = fs_query_fontset (name, 2);
!   if (id >= 0)
!     {
!       fontset = FONTSET_FROM_ID (id);
!       tem = FONTSET_NAME (fontset);
!       error ("Fontset `%s' matches the existing fontset `%s'",
!            SDATA (name),  SDATA (tem));
!     }
  
    /* Check the validity of FONTLIST while creating a template for
       fontset elements.  */
***************
*** 1048,1054 ****
      return Vdefault_fontset;
  
    CHECK_STRING (name);
!   id = fs_query_fontset (name, 0);
    if (id < 0)
      error ("Fontset `%s' does not exist", SDATA (name));
    return FONTSET_FROM_ID (id);
--- 1057,1067 ----
      return Vdefault_fontset;
  
    CHECK_STRING (name);
!   /* First try NAME as literal.  */
!   id = fs_query_fontset (name, 2);
!   if (id < 0)
!     /* For backward compatibility, try again NAME as pattern.  */
!     id = fs_query_fontset (name, 0);
    if (id < 0)
      error ("Fontset `%s' does not exist", SDATA (name));
    return FONTSET_FROM_ID (id);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]