GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
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
tzstring = (char *) SDATA (zone);
else if (INTEGERP (zone))
{
- int abszone = abs (XINT (zone));
+ int abszone = eabs (XINT (zone));
sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0),
abszone / (60*60), (abszone/60) % 60, abszone % 60);
tzstring = tzbuf;
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
precision ::= '.' [0-9]*
If a field-width is specified, it specifies to which width
- the output should be padded with blanks, iff the output
+ the output should be padded with blanks, if the output
string is shorter than field-width.
If precision is specified, it specifies the number of
(startr1, endr1, startr2, endr2, leave_markers)
Lisp_Object startr1, endr1, startr2, endr2, leave_markers;
{
- register int start1, end1, start2, end2;
- int start1_byte, start2_byte, len1_byte, len2_byte;
- int gap, len1, len_mid, len2;
+ register EMACS_INT start1, end1, start2, end2;
+ EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte;
+ EMACS_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);
tmp_interval2 = copy_intervals (cur_intv, start2, len2);
/* Don't use Fset_text_properties: that can cause GC, which can
clobber objects stored in the tmp_intervals. */
- set_text_properties_1 (make_number (start1), make_number (end2),
- Qnil, buf, NULL);
+ 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);
- set_text_properties_1 (make_number (start1), make_number (end1),
- Qnil, buf, NULL);
- set_text_properties_1 (make_number (start2), make_number (end2),
- Qnil, buf, NULL);
+
+ 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);
- set_text_properties_1 (make_number (start1), make_number (end2),
- Qnil, buf, NULL);
+
+ 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);
- set_text_properties_1 (make_number (start1), make_number (end2),
- Qnil, buf, NULL);
+
+ 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 (XINT (start1), XINT (end2 - start1),
- XINT (end2 - start1));
+ signal_after_change (start1, end2 - start1, end2 - start1);
return Qnil;
}