diff options
| author | Dave Love | 2002-07-17 10:29:18 +0000 |
|---|---|---|
| committer | Dave Love | 2002-07-17 10:29:18 +0000 |
| commit | 98a3e9763712f9db3aa0f2b71b0e5ba69ade38b8 (patch) | |
| tree | 06841f4175f61982255a42cf230edfa062a386be | |
| parent | 6f197c07d05b591d94527fca34bce3ce2bedca60 (diff) | |
| download | emacs-98a3e9763712f9db3aa0f2b71b0e5ba69ade38b8.tar.gz emacs-98a3e9763712f9db3aa0f2b71b0e5ba69ade38b8.zip | |
Move coding.h.
(Qcodeset, Qdays, Qmonths): New.
(concat): Use CHARACTERP instead of INTERGERP.
(Flocale_codeset): Deleted.
(Flanginfo): New function.
(syms_of_fns): Changed accordingly.
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/fns.c | 84 |
2 files changed, 75 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 864459179fb..d4aaeb3d548 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2002-07-17 Dave Love <fx@gnu.org> | 1 | 2002-07-17 Dave Love <fx@gnu.org> |
| 2 | 2 | ||
| 3 | * fns.c: Move coding.h. | ||
| 4 | (Qcodeset, Qdays, Qmonths): New. | ||
| 5 | (concat): Use CHARACTERP instead of INTERGERP. | ||
| 6 | (Flocale_codeset): Deleted. | ||
| 7 | (Flanginfo): New function. | ||
| 8 | (syms_of_fns): Changed accordingly. | ||
| 9 | |||
| 3 | * coding.c (adjust_coding_eol_type): Fix eol_type/eol_seen mixup. | 10 | * coding.c (adjust_coding_eol_type): Fix eol_type/eol_seen mixup. |
| 4 | 11 | ||
| 5 | 2002-07-16 Dave Love <fx@gnu.org> | 12 | 2002-07-16 Dave Love <fx@gnu.org> |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Random utility Lisp functions. | 1 | /* Random utility Lisp functions. |
| 2 | Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 98, 99, 2000, 2001 | 2 | Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 98, 99, 2000, 01, 02 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -34,7 +34,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 34 | #include "lisp.h" | 34 | #include "lisp.h" |
| 35 | #include "commands.h" | 35 | #include "commands.h" |
| 36 | #include "character.h" | 36 | #include "character.h" |
| 37 | 37 | #include "coding.h" | |
| 38 | #include "buffer.h" | 38 | #include "buffer.h" |
| 39 | #include "keyboard.h" | 39 | #include "keyboard.h" |
| 40 | #include "keymap.h" | 40 | #include "keymap.h" |
| @@ -56,11 +56,13 @@ int use_dialog_box; | |||
| 56 | 56 | ||
| 57 | extern int minibuffer_auto_raise; | 57 | extern int minibuffer_auto_raise; |
| 58 | extern Lisp_Object minibuf_window; | 58 | extern Lisp_Object minibuf_window; |
| 59 | extern Lisp_Object Vlocale_coding_system; | ||
| 59 | 60 | ||
| 60 | Lisp_Object Qstring_lessp, Qprovide, Qrequire; | 61 | Lisp_Object Qstring_lessp, Qprovide, Qrequire; |
| 61 | Lisp_Object Qyes_or_no_p_history; | 62 | Lisp_Object Qyes_or_no_p_history; |
| 62 | Lisp_Object Qcursor_in_echo_area; | 63 | Lisp_Object Qcursor_in_echo_area; |
| 63 | Lisp_Object Qwidget_type; | 64 | Lisp_Object Qwidget_type; |
| 65 | Lisp_Object Qcodeset, Qdays, Qmonths; | ||
| 64 | 66 | ||
| 65 | extern Lisp_Object Qinput_method_function; | 67 | extern Lisp_Object Qinput_method_function; |
| 66 | 68 | ||
| @@ -579,8 +581,8 @@ concat (nargs, args, target_type, last_special) | |||
| 579 | for (i = 0; i < len; i++) | 581 | for (i = 0; i < len; i++) |
| 580 | { | 582 | { |
| 581 | ch = XVECTOR (this)->contents[i]; | 583 | ch = XVECTOR (this)->contents[i]; |
| 582 | if (! INTEGERP (ch)) | 584 | if (! CHARACTERP (ch)) |
| 583 | wrong_type_argument (Qintegerp, ch); | 585 | wrong_type_argument (Qcharacterp, ch); |
| 584 | this_len_byte = CHAR_BYTES (XINT (ch)); | 586 | this_len_byte = CHAR_BYTES (XINT (ch)); |
| 585 | result_len_byte += this_len_byte; | 587 | result_len_byte += this_len_byte; |
| 586 | if (!SINGLE_BYTE_CHAR_P (XINT (ch))) | 588 | if (!SINGLE_BYTE_CHAR_P (XINT (ch))) |
| @@ -592,8 +594,8 @@ concat (nargs, args, target_type, last_special) | |||
| 592 | for (; CONSP (this); this = XCDR (this)) | 594 | for (; CONSP (this); this = XCDR (this)) |
| 593 | { | 595 | { |
| 594 | ch = XCAR (this); | 596 | ch = XCAR (this); |
| 595 | if (! INTEGERP (ch)) | 597 | if (! CHARACTERP (ch)) |
| 596 | wrong_type_argument (Qintegerp, ch); | 598 | wrong_type_argument (Qcharacterp, ch); |
| 597 | this_len_byte = CHAR_BYTES (XINT (ch)); | 599 | this_len_byte = CHAR_BYTES (XINT (ch)); |
| 598 | result_len_byte += this_len_byte; | 600 | result_len_byte += this_len_byte; |
| 599 | if (!SINGLE_BYTE_CHAR_P (XINT (ch))) | 601 | if (!SINGLE_BYTE_CHAR_P (XINT (ch))) |
| @@ -2737,19 +2739,63 @@ usage: (widget-apply WIDGET PROPERTY &rest ARGS) */) | |||
| 2737 | #include <langinfo.h> | 2739 | #include <langinfo.h> |
| 2738 | #endif | 2740 | #endif |
| 2739 | 2741 | ||
| 2740 | /* Fixme: is it useful to get more general info from the locale? */ | 2742 | DEFUN ("langinfo", Flanginfo, Slanginfo, 1, 1, 0, |
| 2741 | DEFUN ("locale-codeset", Flocale_codeset, Slocale_codeset, 0, 0, 0, | 2743 | doc: /* Access locale category ITEM, if available. |
| 2742 | doc: /* Return a string indicating the code set in the current locale. | 2744 | |
| 2745 | ITEM may be one of the following: | ||
| 2746 | `codeset', returning the character set as a string (CODESET); | ||
| 2747 | `days', returning a 7-element vector of day names (DAY_n); | ||
| 2748 | `months', returning a 12-element vector of month names (MON_n). | ||
| 2749 | |||
| 2743 | If the system can't provide such information through a call to | 2750 | If the system can't provide such information through a call to |
| 2744 | nl_langinfo(3), return nil. */) | 2751 | nl_langinfo(3), return nil. */) |
| 2745 | () | 2752 | (item) |
| 2753 | Lisp_Object item; | ||
| 2746 | { | 2754 | { |
| 2755 | char *str = NULL; | ||
| 2747 | #ifdef HAVE_LANGINFO_CODESET | 2756 | #ifdef HAVE_LANGINFO_CODESET |
| 2748 | char *str = nl_langinfo (CODESET); | 2757 | Lisp_Object val; |
| 2749 | return make_string (str, strlen (str)); | 2758 | if (EQ (item, Qcodeset)) |
| 2750 | #else | 2759 | str = nl_langinfo (CODESET); |
| 2751 | return Qnil; | 2760 | #ifdef DAY_1 |
| 2761 | else if (EQ (item, Qdays)) /* e.g. for calendar-day-name-array */ | ||
| 2762 | { | ||
| 2763 | Lisp_Object v = Fmake_vector (make_number (7), Qnil); | ||
| 2764 | int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7}; | ||
| 2765 | int i; | ||
| 2766 | for (i = 0; i < 7; i++) | ||
| 2767 | { | ||
| 2768 | str = nl_langinfo (days[i]); | ||
| 2769 | Faset (v, make_number (i), | ||
| 2770 | code_convert_string (make_unibyte_string (str, strlen (str)), | ||
| 2771 | Vlocale_coding_system, Qnil, 0, 0, 1)); | ||
| 2772 | } | ||
| 2773 | return val; | ||
| 2774 | } | ||
| 2752 | #endif | 2775 | #endif |
| 2776 | #ifdef MON_1 | ||
| 2777 | else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */ | ||
| 2778 | { | ||
| 2779 | struct Lisp_Vector *p = allocate_vector (12); | ||
| 2780 | int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, | ||
| 2781 | MON_8, MON_9, MON_10, MON_11, MON_12}; | ||
| 2782 | int i; | ||
| 2783 | for (i = 0; i < 12; i++) | ||
| 2784 | { | ||
| 2785 | str = nl_langinfo (months[i]); | ||
| 2786 | p->contents[i] = | ||
| 2787 | code_convert_string (make_unibyte_string (str, strlen (str)), | ||
| 2788 | Vlocale_coding_system, Qnil, 0, 0, 1); | ||
| 2789 | } | ||
| 2790 | XSETVECTOR (val, p); | ||
| 2791 | return val; | ||
| 2792 | } | ||
| 2793 | #endif | ||
| 2794 | #endif | ||
| 2795 | if (str) | ||
| 2796 | return build_string (str); | ||
| 2797 | else | ||
| 2798 | return Qnil; | ||
| 2753 | } | 2799 | } |
| 2754 | 2800 | ||
| 2755 | /* base64 encode/decode functions (RFC 2045). | 2801 | /* base64 encode/decode functions (RFC 2045). |
| @@ -4530,7 +4576,6 @@ including negative integers. */) | |||
| 4530 | ************************************************************************/ | 4576 | ************************************************************************/ |
| 4531 | 4577 | ||
| 4532 | #include "md5.h" | 4578 | #include "md5.h" |
| 4533 | #include "coding.h" | ||
| 4534 | 4579 | ||
| 4535 | DEFUN ("md5", Fmd5, Smd5, 1, 5, 0, | 4580 | DEFUN ("md5", Fmd5, Smd5, 1, 5, 0, |
| 4536 | doc: /* Return MD5 message digest of OBJECT, a buffer or string. | 4581 | doc: /* Return MD5 message digest of OBJECT, a buffer or string. |
| @@ -4824,6 +4869,13 @@ Used by `featurep' and `require', and altered by `provide'. */); | |||
| 4824 | Qsubfeatures = intern ("subfeatures"); | 4869 | Qsubfeatures = intern ("subfeatures"); |
| 4825 | staticpro (&Qsubfeatures); | 4870 | staticpro (&Qsubfeatures); |
| 4826 | 4871 | ||
| 4872 | Qcodeset = intern ("codeset"); | ||
| 4873 | staticpro (&Qcodeset); | ||
| 4874 | Qdays = intern ("days"); | ||
| 4875 | staticpro (&Qdays); | ||
| 4876 | Qmonths = intern ("months"); | ||
| 4877 | staticpro (&Qmonths); | ||
| 4878 | |||
| 4827 | DEFVAR_BOOL ("use-dialog-box", &use_dialog_box, | 4879 | DEFVAR_BOOL ("use-dialog-box", &use_dialog_box, |
| 4828 | doc: /* *Non-nil means mouse commands use dialog boxes to ask questions. | 4880 | doc: /* *Non-nil means mouse commands use dialog boxes to ask questions. |
| 4829 | This applies to y-or-n and yes-or-no questions asked by commands | 4881 | This applies to y-or-n and yes-or-no questions asked by commands |
| @@ -4887,7 +4939,7 @@ invoked by mouse clicks and mouse menu items. */); | |||
| 4887 | defsubr (&Sbase64_encode_string); | 4939 | defsubr (&Sbase64_encode_string); |
| 4888 | defsubr (&Sbase64_decode_string); | 4940 | defsubr (&Sbase64_decode_string); |
| 4889 | defsubr (&Smd5); | 4941 | defsubr (&Smd5); |
| 4890 | defsubr (&Slocale_codeset); | 4942 | defsubr (&Slanginfo); |
| 4891 | } | 4943 | } |
| 4892 | 4944 | ||
| 4893 | 4945 | ||