Mercurial > hg > xemacs-beta
changeset 5254:1537701f08a1
Support Roman month numbers, #'format-time-string
src/ChangeLog addition:
2010-09-02 Aidan Kehoe <kehoea@parhasard.net>
* strftime.c (roman_upper, roman_lower, strftime):
Implement Roman month numbers, as used in central and eastern
Europe.
* editfns.c (Fformat_time_string):
Document two new escapes, to allow uppercase and lowercase Roman
month numbers. Remove documentation of a bug that we didn't
actually have.
* text.h (Qtime_function_encoding): We know the text encoding
coming from strftime(), because we always use the one in
strftime.c. Don't use Qnative.
man/ChangeLog addition:
2010-09-02 Aidan Kehoe <kehoea@parhasard.net>
* lispref/os.texi (Time Conversion):
Document the new #'format-time-string flags for Roman month
numbers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 02 Sep 2010 12:00:06 +0100 |
parents | b6a398dbb403 |
children | b5611afbcc76 |
files | man/ChangeLog man/lispref/os.texi src/ChangeLog src/editfns.c src/strftime.c src/text.h |
diffstat | 6 files changed, 46 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/man/ChangeLog Wed Sep 01 12:51:32 2010 +0100 +++ b/man/ChangeLog Thu Sep 02 12:00:06 2010 +0100 @@ -1,3 +1,9 @@ +2010-09-02 Aidan Kehoe <kehoea@parhasard.net> + + * lispref/os.texi (Time Conversion): + Document the new #'format-time-string flags for Roman month + numbers. + 2010-08-30 Aidan Kehoe <kehoea@parhasard.net> * lispref/eval.texi (Evaluation, Multiple values):
--- a/man/lispref/os.texi Wed Sep 01 12:51:32 2010 +0100 +++ b/man/lispref/os.texi Thu Sep 02 12:00:06 2010 +0100 @@ -1026,6 +1026,10 @@ This stands for the year with century. @item %Z This stands for the time zone abbreviation. +@item %\xe6 (the ISO-8859-1 lowercase ae character) +This stands for the month as a lowercase Roman number (i-xii) +@item %\xc6 (the ISO-8859-1 uppercase AE character) +This stands for the month as an uppercase Roman number (I-XII) @end table @end defun
--- a/src/ChangeLog Wed Sep 01 12:51:32 2010 +0100 +++ b/src/ChangeLog Thu Sep 02 12:00:06 2010 +0100 @@ -1,3 +1,16 @@ +2010-09-02 Aidan Kehoe <kehoea@parhasard.net> + + * strftime.c (roman_upper, roman_lower, strftime): + Implement Roman month numbers, as used in central and eastern + Europe. + * editfns.c (Fformat_time_string): + Document two new escapes, to allow uppercase and lowercase Roman + month numbers. Remove documentation of a bug that we didn't + actually have. + * text.h (Qtime_function_encoding): We know the text encoding + coming from strftime(), because we always use the one in + strftime.c. Don't use Qnative. + 2010-09-01 Aidan Kehoe <kehoea@parhasard.net> * fns.c (list_merge, list_array_merge_into_list)
--- a/src/editfns.c Wed Sep 01 12:51:32 2010 +0100 +++ b/src/editfns.c Thu Sep 02 12:00:06 2010 +0100 @@ -1044,11 +1044,10 @@ %Y is replaced by the year with century. %z is replaced by the time zone as a numeric offset (e.g +0530, -0800 etc.) %Z is replaced by the time zone abbreviation. +%\xe6 is replaced by the month as a lowercase Roman number (i-xii) +%\xc6 is replaced by the month as an uppercase Roman number (I-XII) The number of options reflects the `strftime' function. - -BUG: If the charset used by the current locale is not ISO 8859-1, the -characters appearing in the day and month names may be incorrect. */ (format_string, time_)) {
--- a/src/strftime.c Wed Sep 01 12:51:32 2010 +0100 +++ b/src/strftime.c Thu Sep 02 12:00:06 2010 +0100 @@ -132,6 +132,16 @@ "July", "August", "September", "October", "November", "December" }; +static char const * const roman_upper[] = +{ + "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" +}; + +static char const * const roman_lower[] = +{ + "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x", "xi", "xii" +}; + /* Add character C to STRING and increment LENGTH, unless LENGTH would exceed MAX. */ @@ -601,6 +611,16 @@ add_num3 (&string[length], (1900 + tm->tm_year) % 1000, max - length, zero); break; + case '\xe6': + length += + add_str (&string[length], roman_lower[tm->tm_mon], + max - length); + break; + case '\xC6': + length += + add_str (&string[length], roman_upper[tm->tm_mon], + max - length); + break; } } }
--- a/src/text.h Wed Sep 01 12:51:32 2010 +0100 +++ b/src/text.h Thu Sep 02 12:00:06 2010 +0100 @@ -3095,7 +3095,7 @@ #endif #define Qunix_host_name_encoding Qnative #define Qunix_service_name_encoding Qnative -#define Qtime_function_encoding Qnative +#define Qtime_function_encoding Qbinary #define Qtime_zone_encoding Qtime_function_encoding #define Qmswindows_host_name_encoding Qmswindows_multibyte #define Qmswindows_service_name_encoding Qmswindows_multibyte