comparison src/editfns.c @ 5495:1f0b15040456

Merge.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 01 May 2011 18:44:03 +0100
parents f2881cb841b4
children 56144c8593a8
comparison
equal deleted inserted replaced
5494:861f2601a38b 5495:1f0b15040456
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp. 3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
4 Copyright (C) 1996, 2001, 2002, 2004 Ben Wing. 4 Copyright (C) 1996, 2001, 2002, 2004 Ben Wing.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the 9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any 10 Free Software Foundation, either version 3 of the License, or (at your
11 later version. 11 option) any later version.
12 12
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT 13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details. 16 for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with XEmacs; see the file COPYING. If not, write to 19 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22 20
23 /* Synched up with: Mule 2.0, FSF 19.30. */ 21 /* Synched up with: Mule 2.0, FSF 19.30. */
24 22
25 /* This file has been Mule-ized, June 2001. */ 23 /* This file has been Mule-ized, June 2001. */
26 24
1042 %X is a locale-specific synonym, which defaults to "%T" in the C locale. 1040 %X is a locale-specific synonym, which defaults to "%T" in the C locale.
1043 %y is replaced by the year without century (00-99). 1041 %y is replaced by the year without century (00-99).
1044 %Y is replaced by the year with century. 1042 %Y is replaced by the year with century.
1045 %z is replaced by the time zone as a numeric offset (e.g +0530, -0800 etc.) 1043 %z is replaced by the time zone as a numeric offset (e.g +0530, -0800 etc.)
1046 %Z is replaced by the time zone abbreviation. 1044 %Z is replaced by the time zone abbreviation.
1045 %\\xe6 is replaced by the month as a lowercase Roman number (i-xii)
1046 %\\xc6 is replaced by the month as an uppercase Roman number (I-XII)
1047 1047
1048 The number of options reflects the `strftime' function. 1048 The number of options reflects the `strftime' function.
1049
1050 BUG: If the charset used by the current locale is not ISO 8859-1, the
1051 characters appearing in the day and month names may be incorrect.
1052 */ 1049 */
1053 (format_string, time_)) 1050 (format_string, time_))
1054 { 1051 {
1055 time_t value; 1052 time_t value;
1056 Bytecount size; 1053 Bytecount size;
1101 (specified_time)) 1098 (specified_time))
1102 { 1099 {
1103 time_t time_spec; 1100 time_t time_spec;
1104 struct tm save_tm; 1101 struct tm save_tm;
1105 struct tm *decoded_time; 1102 struct tm *decoded_time;
1106 Lisp_Object list_args[9];
1107 1103
1108 if (! lisp_to_time (specified_time, &time_spec)) 1104 if (! lisp_to_time (specified_time, &time_spec))
1109 invalid_argument ("Invalid time specification", Qunbound); 1105 invalid_argument ("Invalid time specification", Qunbound);
1110 1106
1111 decoded_time = localtime (&time_spec); 1107 decoded_time = localtime (&time_spec);
1112 list_args[0] = make_int (decoded_time->tm_sec);
1113 list_args[1] = make_int (decoded_time->tm_min);
1114 list_args[2] = make_int (decoded_time->tm_hour);
1115 list_args[3] = make_int (decoded_time->tm_mday);
1116 list_args[4] = make_int (decoded_time->tm_mon + 1);
1117 list_args[5] = make_int (decoded_time->tm_year + 1900);
1118 list_args[6] = make_int (decoded_time->tm_wday);
1119 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil;
1120 1108
1121 /* Make a copy, in case gmtime modifies the struct. */ 1109 /* Make a copy, in case gmtime modifies the struct. */
1122 save_tm = *decoded_time; 1110 save_tm = *decoded_time;
1123 decoded_time = gmtime (&time_spec); 1111 decoded_time = gmtime (&time_spec);
1124 if (decoded_time == 0) 1112
1125 list_args[8] = Qnil; 1113 return listn(9,
1126 else 1114 make_int (save_tm.tm_sec),
1127 list_args[8] = make_int (difftm (&save_tm, decoded_time)); 1115 make_int (save_tm.tm_min),
1128 return Flist (9, list_args); 1116 make_int (save_tm.tm_hour),
1117 make_int (save_tm.tm_mday),
1118 make_int (save_tm.tm_mon + 1),
1119 make_int (save_tm.tm_year + 1900),
1120 make_int (save_tm.tm_wday),
1121 save_tm.tm_isdst ? Qt : Qnil,
1122 (decoded_time == NULL)
1123 ? Qnil
1124 : make_int (difftm (&save_tm, decoded_time)));
1129 } 1125 }
1130 1126
1131 static void set_time_zone_rule (Extbyte *tzstring); 1127 static void set_time_zone_rule (Extbyte *tzstring);
1132 1128
1133 /* from GNU Emacs 21, per Simon Josefsson, modified by stephen 1129 /* from GNU Emacs 21, per Simon Josefsson, modified by stephen
2260 return (!NILP (b->case_fold_search) 2256 return (!NILP (b->case_fold_search)
2261 ? CANONCASE (b, x1) == CANONCASE (b, x2) 2257 ? CANONCASE (b, x1) == CANONCASE (b, x2)
2262 : x1 == x2) 2258 : x1 == x2)
2263 ? Qt : Qnil; 2259 ? Qt : Qnil;
2264 } 2260 }
2265
2266 DEFUN ("char=", Fchar_Equal, 2, 2, 0, /*
2267 Return t if two characters match, case is significant.
2268 Both arguments must be characters (i.e. NOT integers).
2269 */
2270 (character1, character2))
2271 {
2272 CHECK_CHAR_COERCE_INT (character1);
2273 CHECK_CHAR_COERCE_INT (character2);
2274
2275 return EQ (character1, character2) ? Qt : Qnil;
2276 }
2277 2261
2278 #if 0 /* Undebugged FSFmacs code */ 2262 #if 0 /* Undebugged FSFmacs code */
2279 /* Transpose the markers in two regions of the current buffer, and 2263 /* Transpose the markers in two regions of the current buffer, and
2280 adjust the ones between them if necessary (i.e.: if the regions 2264 adjust the ones between them if necessary (i.e.: if the regions
2281 differ in size). 2265 differ in size).
2397 DEFSYMBOL (Qregion_end); 2381 DEFSYMBOL (Qregion_end);
2398 DEFSYMBOL (Qformat); 2382 DEFSYMBOL (Qformat);
2399 DEFSYMBOL (Quser_files_and_directories); 2383 DEFSYMBOL (Quser_files_and_directories);
2400 2384
2401 DEFSUBR (Fchar_equal); 2385 DEFSUBR (Fchar_equal);
2402 DEFSUBR (Fchar_Equal);
2403 DEFSUBR (Fgoto_char); 2386 DEFSUBR (Fgoto_char);
2404 DEFSUBR (Fstring_to_char); 2387 DEFSUBR (Fstring_to_char);
2405 DEFSUBR (Fchar_to_string); 2388 DEFSUBR (Fchar_to_string);
2406 DEFSUBR (Fbuffer_substring); 2389 DEFSUBR (Fbuffer_substring);
2407 DEFSUBR (Fbuffer_substring_no_properties); 2390 DEFSUBR (Fbuffer_substring_no_properties);