extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
const struct tm *, int));
+
+#ifdef WINDOWSNT
+extern Lisp_Object w32_get_internal_run_time ();
+#endif
+
static int tm_diff P_ ((struct tm *, struct tm *));
static void find_field P_ ((Lisp_Object, Lisp_Object, Lisp_Object, int *, Lisp_Object, int *));
static void update_buffer_properties P_ ((int, int));
DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
doc: /* Set point to POSITION, a number or marker.
-Beginning of buffer is position (point-min), end is (point-max). */)
+Beginning of buffer is position (point-min), end is (point-max).
+
+The return value is POSITION. */)
(position)
register Lisp_Object position;
{
return list3 (make_number ((secs >> 16) & 0xffff),
make_number ((secs >> 0) & 0xffff),
make_number (usecs));
-#else
+#else /* ! HAVE_GETRUSAGE */
+#if WINDOWSNT
+ return w32_get_internal_run_time ();
+#else /* ! WINDOWSNT */
return Fcurrent_time ();
-#endif
+#endif /* WINDOWSNT */
+#endif /* HAVE_GETRUSAGE */
}
\f
between 0 and 23. DAY is an integer between 1 and 31. MONTH is an
integer between 1 and 12. YEAR is an integer indicating the
four-digit year. DOW is the day of week, an integer between 0 and 6,
-where 0 is Sunday. DST is t if daylight savings time is effect,
+where 0 is Sunday. DST is t if daylight saving time is in effect,
otherwise nil. ZONE is an integer indicating the number of seconds
east of Greenwich. (Note that Common Lisp has different meanings for
DOW and ZONE.) */)
ZONE defaults to the current time zone rule. This can
be a string or t (as from `set-time-zone-rule'), or it can be a list
\(as from `current-time-zone') or an integer (as from `decode-time')
-applied without consideration for daylight savings time.
+applied without consideration for daylight saving time.
You can pass more than 7 arguments; then the first six arguments
are used as SECOND through YEAR, and the *last* argument is used as ZONE.
int offset = tm_diff (t, &gmt);
char *s = 0;
char buf[6];
+
#ifdef HAVE_TM_ZONE
if (t->tm_zone)
s = (char *)t->tm_zone;
#endif
#endif /* not HAVE_TM_ZONE */
-#if defined HAVE_TM_ZONE || defined HAVE_TZNAME
- if (s)
- {
- /* On Japanese w32, we can get a Japanese string as time
- zone name. Don't accept that. */
- char *p;
- for (p = s; *p && (isalnum ((unsigned char)*p) || *p == ' '); ++p)
- ;
- if (p == s || *p)
- s = NULL;
- }
-#endif
-
if (!s)
{
/* No local time zone name is available; use "+-NNNN" instead. */
sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60);
s = buf;
}
+
return Fcons (make_number (offset), Fcons (build_string (s), Qnil));
}
else
{
validate_region (&start, &end);
if (XINT (start) == XINT (end))
- return build_string ("");
+ return empty_unibyte_string;
return del_range_1 (XINT (start), XINT (end), 1, 1);
}
\f
The basic structure of a %-sequence is
% <flags> <width> <precision> character
-where flags is [- #0]+, width is [0-9]+, and precision is .[0-9]+
+where flags is [-+ #0]+, width is [0-9]+, and precision is .[0-9]+
usage: (format STRING &rest OBJECTS) */)
(nargs, args)
where
- flags ::= [- #0]+
+ flags ::= [-+ #0]+
field-width ::= [0-9]+
precision ::= '.' [0-9]*
while (format != end
&& (*format == '-' || *format == '0' || *format == '#'
- || * format == ' '))
+ || * format == ' ' || *format == '+'))
++format;
if (*format >= '0' && *format <= '9')
discarded[format - format_start] = 1;
format++;
- while (index("-0# ", *format))
+ while (index("-+0# ", *format))
{
if (*format == '-')
{
int gap, len1, len_mid, len2;
unsigned char *start1_addr, *start2_addr, *temp;
- INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2;
+ INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
+ Lisp_Object buf;
+
+ XSETBUFFER (buf, current_buffer);
cur_intv = BUF_INTERVALS (current_buffer);
validate_region (&startr1, &endr1);
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
- Fset_text_properties (make_number (start1), make_number (end2),
- Qnil, Qnil);
+ /* Don't use Fset_text_properties: that can cause GC, which can
+ clobber objects stored in the tmp_intervals. */
+ tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
+ if (!NULL_INTERVAL_P (tmp_interval3))
+ set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
/* First region smaller than second. */
if (len1_byte < len2_byte)
record_change (start2, len2);
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
- Fset_text_properties (make_number (start1), make_number (end1),
- Qnil, Qnil);
- Fset_text_properties (make_number (start2), make_number (end2),
- Qnil, Qnil);
+
+ tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0);
+ if (!NULL_INTERVAL_P (tmp_interval3))
+ set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3);
+
+ tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0);
+ if (!NULL_INTERVAL_P (tmp_interval3))
+ set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3);
SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte);
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
- Fset_text_properties (make_number (start1), make_number (end2),
- Qnil, Qnil);
+
+ tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
+ if (!NULL_INTERVAL_P (tmp_interval3))
+ set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
/* holds region 2 */
SAFE_ALLOCA (temp, unsigned char *, len2_byte);
tmp_interval1 = copy_intervals (cur_intv, start1, len1);
tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
- Fset_text_properties (make_number (start1), make_number (end2),
- Qnil, Qnil);
+
+ tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
+ if (!NULL_INTERVAL_P (tmp_interval3))
+ set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
/* holds region 1 */
SAFE_ALLOCA (temp, unsigned char *, len1_byte);
fix_start_end_in_overlays (start1, end2);
}
+ signal_after_change (start1, end2 - start1, end2 - start1);
return Qnil;
}