aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-08-21 19:48:17 +0000
committerGerd Moellmann2000-08-21 19:48:17 +0000
commitacb7cc8983515906faf9678d93df79b557f06c90 (patch)
treed741d50fccf091d614c16e008998cd620733ba70 /src
parent9a4f9d3026e6186f9679dc153c5d541c26584a53 (diff)
downloademacs-acb7cc8983515906faf9678d93df79b557f06c90.tar.gz
emacs-acb7cc8983515906faf9678d93df79b557f06c90.zip
(find_field): Formatting changes.
(toplevel): Some old-style function forward declarations changed to prototypes, some new protypes added, some functions made static.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/editfns.c162
2 files changed, 106 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ca7a2b9295a..65491e0a0f3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
12000-08-21 Gerd Moellmann <gerd@gnu.org> 12000-08-21 Gerd Moellmann <gerd@gnu.org>
2 2
3 * editfns.c (find_field): Formatting changes.
4 (toplevel): Some old-style function forward declarations
5 changed to prototypes, some new protypes added, some functions
6 made static.
7
8 * lisp.h (set_time_zone_rule): Add prototype.
9 (use_dialog_box): External declaration.
10
3 * keyboard.c (gen_help_event): Add parameter SIZE. 11 * keyboard.c (gen_help_event): Add parameter SIZE.
4 (kbd_buffer_events_waiting): Slightly rewritten. 12 (kbd_buffer_events_waiting): Slightly rewritten.
5 (clear_event): New function. 13 (clear_event): New function.
diff --git a/src/editfns.c b/src/editfns.c
index b4962a2fd32..eab21a4e82a 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,5 +1,6 @@
1/* Lisp functions pertaining to editing. 1/* Lisp functions pertaining to editing.
2 Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999 Free Software Foundation, Inc. 2 Copyright (C) 1985,86,87,89,93,94,95,96,97,98, 1999, 2000
3 Free Software Foundation, Inc.
3 4
4This file is part of GNU Emacs. 5This file is part of GNU Emacs.
5 6
@@ -49,19 +50,29 @@ Boston, MA 02111-1307, USA. */
49#endif 50#endif
50 51
51extern char **environ; 52extern char **environ;
52extern int use_dialog_box; 53extern Lisp_Object make_time P_ ((time_t));
53extern Lisp_Object make_time (); 54extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
54extern void insert_from_buffer (); 55 const struct tm *, int));
55static int tm_diff (); 56static int tm_diff P_ ((struct tm *, struct tm *));
56static void update_buffer_properties (); 57static void find_field P_ ((Lisp_Object, Lisp_Object, int *, int *));
57size_t emacs_strftimeu (); 58static void update_buffer_properties P_ ((int, int));
58void set_time_zone_rule (); 59static Lisp_Object region_limit P_ ((int));
60static int lisp_time_argument P_ ((Lisp_Object, time_t *, int *));
61static size_t emacs_memftimeu P_ ((char *, size_t, const char *,
62 size_t, const struct tm *, int));
63static void general_insert_function P_ ((void (*) (unsigned char *, int),
64 void (*) (Lisp_Object, int, int, int,
65 int, int),
66 int, int, Lisp_Object *));
67static Lisp_Object subst_char_in_region_unwind P_ ((Lisp_Object));
68static Lisp_Object subst_char_in_region_unwind_1 P_ ((Lisp_Object));
69static void transpose_markers P_ ((int, int, int, int, int, int, int, int));
59 70
60Lisp_Object Vbuffer_access_fontify_functions; 71Lisp_Object Vbuffer_access_fontify_functions;
61Lisp_Object Qbuffer_access_fontify_functions; 72Lisp_Object Qbuffer_access_fontify_functions;
62Lisp_Object Vbuffer_access_fontified_property; 73Lisp_Object Vbuffer_access_fontified_property;
63 74
64Lisp_Object Fuser_full_name (); 75Lisp_Object Fuser_full_name P_ ((Lisp_Object));
65 76
66/* Non-nil means don't stop at field boundary in text motion commands. */ 77/* Non-nil means don't stop at field boundary in text motion commands. */
67 78
@@ -74,6 +85,15 @@ Lisp_Object Vuser_real_login_name; /* login name of current user ID */
74Lisp_Object Vuser_full_name; /* full name of current user */ 85Lisp_Object Vuser_full_name; /* full name of current user */
75Lisp_Object Vuser_login_name; /* user name from LOGNAME or USER */ 86Lisp_Object Vuser_login_name; /* user name from LOGNAME or USER */
76 87
88/* Symbol for the text property used to mark fields. */
89
90Lisp_Object Qfield;
91
92/* A special value for Qfield properties. */
93
94Lisp_Object Qboundary;
95
96
77void 97void
78init_editfns () 98init_editfns ()
79{ 99{
@@ -237,35 +257,44 @@ except in the case that `enable-multibyte-characters' is nil.")
237 return position; 257 return position;
238} 258}
239 259
260
261/* Return the start or end position of the region.
262 BEGINNINGP non-zero means return the start.
263 If there is no region active, signal an error. */
264
240static Lisp_Object 265static Lisp_Object
241region_limit (beginningp) 266region_limit (beginningp)
242 int beginningp; 267 int beginningp;
243{ 268{
244 extern Lisp_Object Vmark_even_if_inactive; /* Defined in callint.c. */ 269 extern Lisp_Object Vmark_even_if_inactive; /* Defined in callint.c. */
245 register Lisp_Object m; 270 Lisp_Object m;
246 if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive) 271
272 if (!NILP (Vtransient_mark_mode)
273 && NILP (Vmark_even_if_inactive)
247 && NILP (current_buffer->mark_active)) 274 && NILP (current_buffer->mark_active))
248 Fsignal (Qmark_inactive, Qnil); 275 Fsignal (Qmark_inactive, Qnil);
276
249 m = Fmarker_position (current_buffer->mark); 277 m = Fmarker_position (current_buffer->mark);
250 if (NILP (m)) error ("There is no region now"); 278 if (NILP (m))
279 error ("There is no region now");
280
251 if ((PT < XFASTINT (m)) == beginningp) 281 if ((PT < XFASTINT (m)) == beginningp)
252 return (make_number (PT)); 282 m = make_number (PT);
253 else 283 return m;
254 return (m);
255} 284}
256 285
257DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0, 286DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,
258 "Return position of beginning of region, as an integer.") 287 "Return position of beginning of region, as an integer.")
259 () 288 ()
260{ 289{
261 return (region_limit (1)); 290 return region_limit (1);
262} 291}
263 292
264DEFUN ("region-end", Fregion_end, Sregion_end, 0, 0, 0, 293DEFUN ("region-end", Fregion_end, Sregion_end, 0, 0, 0,
265 "Return position of end of region, as an integer.") 294 "Return position of end of region, as an integer.")
266 () 295 ()
267{ 296{
268 return (region_limit (0)); 297 return region_limit (0);
269} 298}
270 299
271DEFUN ("mark-marker", Fmark_marker, Smark_marker, 0, 0, 0, 300DEFUN ("mark-marker", Fmark_marker, Smark_marker, 0, 0, 0,
@@ -276,6 +305,7 @@ If you set the marker not to point anywhere, the buffer will have no mark.")
276{ 305{
277 return current_buffer->mark; 306 return current_buffer->mark;
278} 307}
308
279 309
280/* Return nonzero if POS1 and POS2 have the same value 310/* Return nonzero if POS1 and POS2 have the same value
281 for the text property PROP. */ 311 for the text property PROP. */
@@ -333,15 +363,11 @@ char_property_stickiness (prop, pos)
333 /* PROP is not inherited from either side. */ 363 /* PROP is not inherited from either side. */
334 return 0; 364 return 0;
335} 365}
336
337/* Symbol for the text property used to mark fields. */
338Lisp_Object Qfield;
339
340/* A special value for Qfield properties. */
341Lisp_Object Qboundary;
342 366
367
343/* Find the field surrounding POS in *BEG and *END. If POS is nil, 368/* Find the field surrounding POS in *BEG and *END. If POS is nil,
344 the value of point is used instead. 369 the value of point is used instead. If BEG or END null,
370 means don't store the beginning or end of the field.
345 371
346 If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first 372 If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first
347 position of a field, then the beginning of the previous field is 373 position of a field, then the beginning of the previous field is
@@ -356,7 +382,7 @@ Lisp_Object Qboundary;
356 Either BEG or END may be 0, in which case the corresponding value 382 Either BEG or END may be 0, in which case the corresponding value
357 is not stored. */ 383 is not stored. */
358 384
359void 385static void
360find_field (pos, merge_at_boundary, beg, end) 386find_field (pos, merge_at_boundary, beg, end)
361 Lisp_Object pos; 387 Lisp_Object pos;
362 Lisp_Object merge_at_boundary; 388 Lisp_Object merge_at_boundary;
@@ -374,12 +400,12 @@ find_field (pos, merge_at_boundary, beg, end)
374 else 400 else
375 CHECK_NUMBER_COERCE_MARKER (pos, 0); 401 CHECK_NUMBER_COERCE_MARKER (pos, 0);
376 402
377 after_field = 403 after_field
378 Fget_char_property (pos, Qfield, Qnil); 404 = Fget_char_property (pos, Qfield, Qnil);
379 before_field = 405 before_field
380 (XFASTINT (pos) > BEGV 406 = (XFASTINT (pos) > BEGV
381 ? Fget_char_property (make_number (XINT (pos) - 1), Qfield, Qnil) 407 ? Fget_char_property (make_number (XINT (pos) - 1), Qfield, Qnil)
382 : Qnil); 408 : Qnil);
383 409
384 /* See if we need to handle the case where MERGE_AT_BOUNDARY is nil 410 /* See if we need to handle the case where MERGE_AT_BOUNDARY is nil
385 and POS is at beginning of a field, which can also be interpreted 411 and POS is at beginning of a field, which can also be interpreted
@@ -433,37 +459,42 @@ find_field (pos, merge_at_boundary, beg, end)
433 the `x' field, and the end as being the end of the `y' field. */ 459 the `x' field, and the end as being the end of the `y' field. */
434 460
435 if (beg) 461 if (beg)
436 if (at_field_start) 462 {
437 /* POS is at the edge of a field, and we should consider it as 463 if (at_field_start)
438 the beginning of the following field. */ 464 /* POS is at the edge of a field, and we should consider it as
439 *beg = XFASTINT (pos); 465 the beginning of the following field. */
440 else 466 *beg = XFASTINT (pos);
441 /* Find the previous field boundary. */ 467 else
442 { 468 /* Find the previous field boundary. */
443 if (!NILP (merge_at_boundary) && EQ (before_field, Qboundary)) 469 {
444 /* Skip a `boundary' field. */ 470 if (!NILP (merge_at_boundary) && EQ (before_field, Qboundary))
445 pos = Fprevious_single_char_property_change (pos, Qfield, Qnil,Qnil); 471 /* Skip a `boundary' field. */
472 pos = Fprevious_single_char_property_change (pos, Qfield, Qnil,Qnil);
446 473
447 pos = Fprevious_single_char_property_change (pos, Qfield, Qnil, Qnil); 474 pos = Fprevious_single_char_property_change (pos, Qfield, Qnil, Qnil);
448 *beg = NILP (pos) ? BEGV : XFASTINT (pos); 475 *beg = NILP (pos) ? BEGV : XFASTINT (pos);
449 } 476 }
477 }
450 478
451 if (end) 479 if (end)
452 if (at_field_end) 480 {
453 /* POS is at the edge of a field, and we should consider it as 481 if (at_field_end)
454 the end of the previous field. */ 482 /* POS is at the edge of a field, and we should consider it as
455 *end = XFASTINT (pos); 483 the end of the previous field. */
456 else 484 *end = XFASTINT (pos);
457 /* Find the next field boundary. */ 485 else
458 { 486 /* Find the next field boundary. */
459 if (!NILP (merge_at_boundary) && EQ (after_field, Qboundary)) 487 {
460 /* Skip a `boundary' field. */ 488 if (!NILP (merge_at_boundary) && EQ (after_field, Qboundary))
461 pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil); 489 /* Skip a `boundary' field. */
490 pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil);
462 491
463 pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil); 492 pos = Fnext_single_char_property_change (pos, Qfield, Qnil, Qnil);
464 *end = NILP (pos) ? ZV : XFASTINT (pos); 493 *end = NILP (pos) ? ZV : XFASTINT (pos);
465 } 494 }
495 }
466} 496}
497
467 498
468DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, 499DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0,
469 "Delete the field surrounding POS.\n\ 500 "Delete the field surrounding POS.\n\
@@ -620,6 +651,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.")
620 651
621 return new_pos; 652 return new_pos;
622} 653}
654
623 655
624DEFUN ("line-beginning-position", Fline_beginning_position, Sline_beginning_position, 656DEFUN ("line-beginning-position", Fline_beginning_position, Sline_beginning_position,
625 0, 1, 0, 657 0, 1, 0,
@@ -635,7 +667,7 @@ This function does not move point.")
635 (n) 667 (n)
636 Lisp_Object n; 668 Lisp_Object n;
637{ 669{
638 register int orig, orig_byte, end; 670 int orig, orig_byte, end;
639 671
640 if (NILP (n)) 672 if (NILP (n))
641 XSETFASTINT (n, 1); 673 XSETFASTINT (n, 1);
@@ -665,7 +697,7 @@ This function does not move point.")
665 Lisp_Object n; 697 Lisp_Object n;
666{ 698{
667 int end_pos; 699 int end_pos;
668 register int orig = PT; 700 int orig = PT;
669 701
670 if (NILP (n)) 702 if (NILP (n))
671 XSETFASTINT (n, 1); 703 XSETFASTINT (n, 1);
@@ -682,8 +714,8 @@ This function does not move point.")
682Lisp_Object 714Lisp_Object
683save_excursion_save () 715save_excursion_save ()
684{ 716{
685 register int visible = (XBUFFER (XWINDOW (selected_window)->buffer) 717 int visible = (XBUFFER (XWINDOW (selected_window)->buffer)
686 == current_buffer); 718 == current_buffer);
687 719
688 return Fcons (Fpoint_marker (), 720 return Fcons (Fpoint_marker (),
689 Fcons (Fcopy_marker (current_buffer->mark, Qnil), 721 Fcons (Fcopy_marker (current_buffer->mark, Qnil),
@@ -777,7 +809,7 @@ Executes BODY just like `progn'.")
777 (args) 809 (args)
778 Lisp_Object args; 810 Lisp_Object args;
779{ 811{
780 register Lisp_Object val; 812 Lisp_Object val;
781 int count = specpdl_ptr - specpdl; 813 int count = specpdl_ptr - specpdl;
782 814
783 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 815 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
@@ -1154,6 +1186,7 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0,
1154} 1186}
1155 1187
1156/* For the benefit of callers who don't want to include lisp.h */ 1188/* For the benefit of callers who don't want to include lisp.h */
1189
1157char * 1190char *
1158get_system_name () 1191get_system_name ()
1159{ 1192{
@@ -1710,6 +1743,7 @@ static char set_time_zone_rule_tz2[] = "TZ=GMT+1";
1710/* Set the local time zone rule to TZSTRING. 1743/* Set the local time zone rule to TZSTRING.
1711 This allocates memory into `environ', which it is the caller's 1744 This allocates memory into `environ', which it is the caller's
1712 responsibility to free. */ 1745 responsibility to free. */
1746
1713void 1747void
1714set_time_zone_rule (tzstring) 1748set_time_zone_rule (tzstring)
1715 char *tzstring; 1749 char *tzstring;
@@ -1791,7 +1825,7 @@ set_time_zone_rule (tzstring)
1791 type of object is Lisp_String). INHERIT is passed to 1825 type of object is Lisp_String). INHERIT is passed to
1792 INSERT_FROM_STRING_FUNC as the last argument. */ 1826 INSERT_FROM_STRING_FUNC as the last argument. */
1793 1827
1794void 1828static void
1795general_insert_function (insert_func, insert_from_string_func, 1829general_insert_function (insert_func, insert_from_string_func,
1796 inherit, nargs, args) 1830 inherit, nargs, args)
1797 void (*insert_func) P_ ((unsigned char *, int)); 1831 void (*insert_func) P_ ((unsigned char *, int));
@@ -3386,7 +3420,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer.")
3386 3420
3387 It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */ 3421 It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */
3388 3422
3389void 3423static void
3390transpose_markers (start1, end1, start2, end2, 3424transpose_markers (start1, end1, start2, end2,
3391 start1_byte, end1_byte, start2_byte, end2_byte) 3425 start1_byte, end1_byte, start2_byte, end2_byte)
3392 register int start1, end1, start2, end2; 3426 register int start1, end1, start2, end2;