Mercurial > hg > xemacs-beta
comparison src/fns.c @ 4910:6bc1f3f6cf0d
Make canoncase visible to Lisp; use it with chars in internal_equalp.
src/ChangeLog addition:
2010-02-01 Aidan Kehoe <kehoea@parhasard.net>
* fns.c (internal_equalp):
Use bytecode_arithcompare, which takes two args, instead of
passing a stack pointer to Feqlsign.
Use CANONCASE(), not DOWNCASE(), for case-insensitive character
comparison.
Correct a comment here.
* casefiddle.c (casify_object): New operation in this function,
CASE_CANONICALIZE.
(Fcanoncase): New function, used for case-insensitive comparison.
* lisp.h:
Make Fcanoncase, bytecode_arithcompare visible here.
* bytecode.c (bytecode_arithcompare):
Make this visible to other files.
lisp/ChangeLog addition:
2010-02-01 Aidan Kehoe <kehoea@parhasard.net>
* cl-macs.el (equalp):
Remove special treatment for an #'equalp with a single character
constant argument, it was incorrect (it used #'downcase instead of
#'canoncase).
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 01 Feb 2010 17:57:04 +0000 |
parents | 6ef8256a020a |
children | 48b63cd88a21 c17c857e20bf |
comparison
equal
deleted
inserted
replaced
4909:87175eb65ff4 | 4910:6bc1f3f6cf0d |
---|---|
2886 return 1; | 2886 return 1; |
2887 | 2887 |
2888 /* 2. If both numbers, compare with `='. */ | 2888 /* 2. If both numbers, compare with `='. */ |
2889 if (NUMBERP (obj1) && NUMBERP (obj2)) | 2889 if (NUMBERP (obj1) && NUMBERP (obj2)) |
2890 { | 2890 { |
2891 Lisp_Object args[2]; | 2891 return (0 == bytecode_arithcompare (obj1, obj2)); |
2892 args[0] = obj1; | |
2893 args[1] = obj2; | |
2894 return !NILP (Feqlsign (2, args)); | |
2895 } | 2892 } |
2896 | 2893 |
2897 /* 3. If characters, compare case-insensitively. */ | 2894 /* 3. If characters, compare case-insensitively. */ |
2898 if (CHARP (obj1) && CHARP (obj2)) | 2895 if (CHARP (obj1) && CHARP (obj2)) |
2899 return DOWNCASE (0, XCHAR (obj1)) == DOWNCASE (0, XCHAR (obj2)); | 2896 return CANONCASE (0, XCHAR (obj1)) == CANONCASE (0, XCHAR (obj2)); |
2900 | 2897 |
2901 /* 4. If arrays of different types, compare their lengths, and | 2898 /* 4. If arrays of different types, compare their lengths, and |
2902 then compare element-by-element. */ | 2899 then compare element-by-element. */ |
2903 { | 2900 { |
2904 enum array_type artype1, artype2; | 2901 enum array_type artype1, artype2; |
2907 if (artype1 != artype2 && artype1 && artype2) | 2904 if (artype1 != artype2 && artype1 && artype2) |
2908 { | 2905 { |
2909 EMACS_INT i; | 2906 EMACS_INT i; |
2910 EMACS_INT l1 = XINT (Flength (obj1)); | 2907 EMACS_INT l1 = XINT (Flength (obj1)); |
2911 EMACS_INT l2 = XINT (Flength (obj2)); | 2908 EMACS_INT l2 = XINT (Flength (obj2)); |
2912 /* Both arrays, but of different types */ | 2909 /* Both arrays, but of different lengths */ |
2913 if (l1 != l2) | 2910 if (l1 != l2) |
2914 return 0; | 2911 return 0; |
2915 for (i = 0; i < l1; i++) | 2912 for (i = 0; i < l1; i++) |
2916 if (!internal_equalp (Faref (obj1, make_int (i)), | 2913 if (!internal_equalp (Faref (obj1, make_int (i)), |
2917 Faref (obj2, make_int (i)), depth + 1)) | 2914 Faref (obj2, make_int (i)), depth + 1)) |