Mercurial > hg > xemacs-beta
comparison src/editfns.c @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 727739f917cb |
children | e11d67e05968 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
26 | 26 |
27 /* Hacked on for Mule by Ben Wing, December 1994. */ | 27 /* Hacked on for Mule by Ben Wing, December 1994. */ |
28 | 28 |
29 #include <config.h> | 29 #include <config.h> |
30 #include "lisp.h" | 30 #include "lisp.h" |
31 #ifdef HAVE_UNISTD_H | |
32 #include <unistd.h> | |
33 #endif | |
31 | 34 |
32 #include "buffer.h" | 35 #include "buffer.h" |
33 #include "commands.h" | 36 #include "commands.h" |
34 #include "events.h" /* for EVENTP */ | 37 #include "events.h" /* for EVENTP */ |
35 #include "extents.h" | 38 #include "extents.h" |
57 #endif | 60 #endif |
58 | 61 |
59 /* It's useful to be able to set this as user customization, so we'll | 62 /* It's useful to be able to set this as user customization, so we'll |
60 keep it. */ | 63 keep it. */ |
61 Lisp_Object Vuser_full_name; | 64 Lisp_Object Vuser_full_name; |
62 Lisp_Object Fuser_full_name (Lisp_Object); | 65 EXFUN (Fuser_full_name, 1); |
63 | 66 |
64 extern char *get_system_name (void); | 67 char *get_system_name (void); |
65 | 68 |
66 Lisp_Object Qformat; | 69 Lisp_Object Qformat; |
67 | 70 |
68 Lisp_Object Qpoint, Qmark, Qregion_beginning, Qregion_end; | 71 Lisp_Object Qpoint, Qmark, Qregion_beginning, Qregion_end; |
69 | 72 |
74 | 77 |
75 void | 78 void |
76 init_editfns (void) | 79 init_editfns (void) |
77 { | 80 { |
78 /* Only used in removed code below. */ | 81 /* Only used in removed code below. */ |
79 Bufbyte *p; | 82 char *p; |
80 | 83 |
81 environbuf = 0; | 84 environbuf = 0; |
82 | 85 |
83 /* Set up system_name even when dumping. */ | 86 /* Set up system_name even when dumping. */ |
84 init_system_name (); | 87 init_system_name (); |
86 #ifndef CANNOT_DUMP | 89 #ifndef CANNOT_DUMP |
87 if (!initialized) | 90 if (!initialized) |
88 return; | 91 return; |
89 #endif | 92 #endif |
90 | 93 |
91 if ((p = (Bufbyte *) getenv ("NAME"))) | 94 if ((p = getenv ("NAME"))) |
92 /* I don't think it's the right thing to do the ampersand | 95 /* I don't think it's the right thing to do the ampersand |
93 modification on NAME. Not that it matters anymore... -hniksic */ | 96 modification on NAME. Not that it matters anymore... -hniksic */ |
94 Vuser_full_name = build_ext_string (p, FORMAT_OS); | 97 Vuser_full_name = build_ext_string (p, FORMAT_OS); |
95 else | 98 else |
96 Vuser_full_name = Fuser_full_name (Qnil); | 99 Vuser_full_name = Fuser_full_name (Qnil); |
140 | 143 |
141 | 144 |
142 static Lisp_Object | 145 static Lisp_Object |
143 buildmark (Bufpos val, Lisp_Object buffer) | 146 buildmark (Bufpos val, Lisp_Object buffer) |
144 { | 147 { |
145 Lisp_Object mark; | 148 Lisp_Object mark = Fmake_marker (); |
146 mark = Fmake_marker (); | |
147 Fset_marker (mark, make_int (val), buffer); | 149 Fset_marker (mark, make_int (val), buffer); |
148 return mark; | 150 return mark; |
149 } | 151 } |
150 | 152 |
151 DEFUN ("point", Fpoint, 0, 1, 0, /* | 153 DEFUN ("point", Fpoint, 0, 1, 0, /* |
180 cleaner to declare them separately. */ | 182 cleaner to declare them separately. */ |
181 | 183 |
182 Bufpos | 184 Bufpos |
183 bufpos_clip_to_bounds (Bufpos lower, Bufpos num, Bufpos upper) | 185 bufpos_clip_to_bounds (Bufpos lower, Bufpos num, Bufpos upper) |
184 { | 186 { |
185 if (num < lower) | 187 return (num < lower ? lower : |
186 return lower; | 188 num > upper ? upper : |
187 else if (num > upper) | 189 num); |
188 return upper; | |
189 else | |
190 return num; | |
191 } | 190 } |
192 | 191 |
193 Bytind | 192 Bytind |
194 bytind_clip_to_bounds (Bytind lower, Bytind num, Bytind upper) | 193 bytind_clip_to_bounds (Bytind lower, Bytind num, Bytind upper) |
195 { | 194 { |
196 if (num < lower) | 195 return (num < lower ? lower : |
197 return lower; | 196 num > upper ? upper : |
198 else if (num > upper) | 197 num); |
199 return upper; | |
200 else | |
201 return num; | |
202 } | 198 } |
203 | 199 |
204 /* | 200 /* |
205 * Chuck says: | 201 * Chuck says: |
206 * There is no absolute way to determine if goto-char is the function | 202 * There is no absolute way to determine if goto-char is the function |
409 save_current_buffer_restore (Lisp_Object buffer) | 405 save_current_buffer_restore (Lisp_Object buffer) |
410 { | 406 { |
411 struct buffer *buf = XBUFFER (buffer); | 407 struct buffer *buf = XBUFFER (buffer); |
412 /* Avoid signaling an error if the buffer is no longer alive. This | 408 /* Avoid signaling an error if the buffer is no longer alive. This |
413 is for consistency with save-excursion. */ | 409 is for consistency with save-excursion. */ |
414 if (!BUFFER_LIVE_P (buf)) | 410 if (BUFFER_LIVE_P (buf)) |
415 return Qnil; | 411 set_buffer_internal (buf); |
416 set_buffer_internal (buf); | |
417 return Qnil; | 412 return Qnil; |
418 } | 413 } |
419 | 414 |
420 DEFUN ("save-current-buffer", Fsave_current_buffer, 0, UNEVALLED, 0, /* | 415 DEFUN ("save-current-buffer", Fsave_current_buffer, 0, UNEVALLED, 0, /* |
421 Save the current buffer; execute BODY; restore the current buffer. | 416 Save the current buffer; execute BODY; restore the current buffer. |
429 record_unwind_protect (save_current_buffer_restore, Fcurrent_buffer ()); | 424 record_unwind_protect (save_current_buffer_restore, Fcurrent_buffer ()); |
430 | 425 |
431 return unbind_to (speccount, Fprogn (args)); | 426 return unbind_to (speccount, Fprogn (args)); |
432 } | 427 } |
433 | 428 |
434 DEFUN ("buffer-size", Fbufsize, 0, 1, 0, /* | 429 DEFUN ("buffer-size", Fbuffer_size, 0, 1, 0, /* |
435 Return the number of characters in BUFFER. | 430 Return the number of characters in BUFFER. |
436 If BUFFER is nil, the current buffer is assumed. | 431 If BUFFER is nil, the current buffer is assumed. |
437 */ | 432 */ |
438 (buffer)) | 433 (buffer)) |
439 { | 434 { |
514 else | 509 else |
515 return make_char (BUF_FETCH_CHAR (b, BUF_PT (b) - 1)); | 510 return make_char (BUF_FETCH_CHAR (b, BUF_PT (b) - 1)); |
516 } | 511 } |
517 | 512 |
518 DEFUN ("bobp", Fbobp, 0, 1, 0, /* | 513 DEFUN ("bobp", Fbobp, 0, 1, 0, /* |
519 Return T if point is at the beginning of the buffer. | 514 Return t if point is at the beginning of the buffer. |
520 If the buffer is narrowed, this means the beginning of the narrowed part. | 515 If the buffer is narrowed, this means the beginning of the narrowed part. |
521 If BUFFER is nil, the current buffer is assumed. | 516 If BUFFER is nil, the current buffer is assumed. |
522 */ | 517 */ |
523 (buffer)) | 518 (buffer)) |
524 { | 519 { |
525 struct buffer *b = decode_buffer (buffer, 1); | 520 struct buffer *b = decode_buffer (buffer, 1); |
526 return BUF_PT (b) == BUF_BEGV (b) ? Qt : Qnil; | 521 return BUF_PT (b) == BUF_BEGV (b) ? Qt : Qnil; |
527 } | 522 } |
528 | 523 |
529 DEFUN ("eobp", Feobp, 0, 1, 0, /* | 524 DEFUN ("eobp", Feobp, 0, 1, 0, /* |
530 Return T if point is at the end of the buffer. | 525 Return t if point is at the end of the buffer. |
531 If the buffer is narrowed, this means the end of the narrowed part. | 526 If the buffer is narrowed, this means the end of the narrowed part. |
532 If BUFFER is nil, the current buffer is assumed. | 527 If BUFFER is nil, the current buffer is assumed. |
533 */ | 528 */ |
534 (buffer)) | 529 (buffer)) |
535 { | 530 { |
538 } | 533 } |
539 | 534 |
540 int | 535 int |
541 beginning_of_line_p (struct buffer *b, Bufpos pt) | 536 beginning_of_line_p (struct buffer *b, Bufpos pt) |
542 { | 537 { |
543 if (pt <= BUF_BEGV (b)) | 538 return pt <= BUF_BEGV (b) || BUF_FETCH_CHAR (b, pt - 1) == '\n'; |
544 return 1; | |
545 return BUF_FETCH_CHAR (b, pt - 1) == '\n'; | |
546 } | 539 } |
547 | 540 |
548 | 541 |
549 DEFUN ("bolp", Fbolp, 0, 1, 0, /* | 542 DEFUN ("bolp", Fbolp, 0, 1, 0, /* |
550 Return T if point is at the beginning of a line. | 543 Return t if point is at the beginning of a line. |
551 If BUFFER is nil, the current buffer is assumed. | 544 If BUFFER is nil, the current buffer is assumed. |
552 */ | 545 */ |
553 (buffer)) | 546 (buffer)) |
554 { | 547 { |
555 struct buffer *b = decode_buffer (buffer, 1); | 548 struct buffer *b = decode_buffer (buffer, 1); |
556 | 549 |
557 return beginning_of_line_p (b, BUF_PT (b)) ? Qt : Qnil; | 550 return beginning_of_line_p (b, BUF_PT (b)) ? Qt : Qnil; |
558 } | 551 } |
559 | 552 |
560 DEFUN ("eolp", Feolp, 0, 1, 0, /* | 553 DEFUN ("eolp", Feolp, 0, 1, 0, /* |
561 Return T if point is at the end of a line. | 554 Return t if point is at the end of a line. |
562 `End of a line' includes point being at the end of the buffer. | 555 `End of a line' includes point being at the end of the buffer. |
563 If BUFFER is nil, the current buffer is assumed. | 556 If BUFFER is nil, the current buffer is assumed. |
564 */ | 557 */ |
565 (buffer)) | 558 (buffer)) |
566 { | 559 { |
567 struct buffer *b = decode_buffer (buffer, 1); | 560 struct buffer *b = decode_buffer (buffer, 1); |
568 if (BUF_PT (b) == BUF_ZV (b) || BUF_FETCH_CHAR (b, BUF_PT (b)) == '\n') | 561 return (BUF_PT (b) == BUF_ZV (b) || BUF_FETCH_CHAR (b, BUF_PT (b)) == '\n') |
569 return Qt; | 562 ? Qt : Qnil; |
570 return Qnil; | |
571 } | 563 } |
572 | 564 |
573 DEFUN ("char-after", Fchar_after, 0, 2, 0, /* | 565 DEFUN ("char-after", Fchar_after, 0, 2, 0, /* |
574 Return character in BUFFER at position POS. | 566 Return character in BUFFER at position POS. |
575 POS is an integer or a buffer pointer. | 567 POS is an integer or a buffer pointer. |
616 On Unix it is obtained from TMPDIR, with /tmp as the default | 608 On Unix it is obtained from TMPDIR, with /tmp as the default |
617 */ | 609 */ |
618 ()) | 610 ()) |
619 { | 611 { |
620 char *tmpdir; | 612 char *tmpdir; |
621 | |
622 #if defined(WINDOWSNT) || defined(MSDOS) | 613 #if defined(WINDOWSNT) || defined(MSDOS) |
623 tmpdir = (char *) getenv ("TEMP"); | 614 tmpdir = getenv ("TEMP"); |
624 if (!tmpdir) | 615 if (!tmpdir) |
625 tmpdir = (char *) getenv ("TMP"); | 616 tmpdir = getenv ("TMP"); |
626 if (!tmpdir) | 617 if (!tmpdir) |
627 tmpdir = "/"; /* what should this be on NT/MSDOS ? */ | 618 tmpdir = "/"; |
628 #else /* WINDOWSNT || MSDOS */ | 619 #else /* WINDOWSNT || MSDOS */ |
629 tmpdir = (char *) getenv ("TMPDIR"); | 620 tmpdir = getenv ("TMPDIR"); |
630 if (!tmpdir) | 621 if (!tmpdir) |
631 tmpdir = "/tmp"; | 622 tmpdir = "/tmp"; |
632 #endif | 623 #endif |
633 | 624 |
634 return build_ext_string (tmpdir, FORMAT_FILENAME); | 625 return build_ext_string (tmpdir, FORMAT_FILENAME); |
635 } | 626 } |
636 | 627 |
647 struct passwd *pw = NULL; | 638 struct passwd *pw = NULL; |
648 | 639 |
649 if (!NILP (uid)) | 640 if (!NILP (uid)) |
650 { | 641 { |
651 CHECK_INT (uid); | 642 CHECK_INT (uid); |
652 pw = (struct passwd *) getpwuid (XINT (uid)); | 643 pw = getpwuid (XINT (uid)); |
653 } | 644 } |
654 else | 645 else |
655 { | 646 { |
656 char *user_name; | |
657 /* #### - when euid != uid, then LOGNAME and USER are leftovers from the | 647 /* #### - when euid != uid, then LOGNAME and USER are leftovers from the |
658 old environment (I site observed behavior on sunos and linux), so the | 648 old environment (I site observed behavior on sunos and linux), so the |
659 environment variables should be disregarded in that case. --Stig */ | 649 environment variables should be disregarded in that case. --Stig */ |
660 user_name = getenv ("LOGNAME"); | 650 char *user_name = getenv ("LOGNAME"); |
661 if (!user_name) | 651 if (!user_name) |
652 user_name = getenv ( | |
662 #ifdef WINDOWSNT | 653 #ifdef WINDOWSNT |
663 user_name = (char *) getenv ("USERNAME"); /* it's USERNAME on NT */ | 654 "USERNAME" /* it's USERNAME on NT */ |
664 #else /* WINDOWSNT */ | 655 #else |
665 user_name = (char *) getenv ("USER"); | 656 "USER" |
666 #endif /* WINDOWSNT */ | 657 #endif |
658 ); | |
667 if (user_name) | 659 if (user_name) |
668 return build_string (user_name); | 660 return build_string (user_name); |
669 else | 661 else |
670 pw = (struct passwd *) getpwuid (geteuid ()); | 662 pw = getpwuid (geteuid ()); |
671 } | 663 } |
672 /* #### - I believe this should return nil instead of "unknown" when pw==0 */ | 664 /* #### - I believe this should return nil instead of "unknown" when pw==0 */ |
673 return pw ? build_string (pw->pw_name) : Qnil; | 665 return pw ? build_string (pw->pw_name) : Qnil; |
674 } | 666 } |
675 | 667 |
678 This ignores the environment variables LOGNAME and USER, so it differs from | 670 This ignores the environment variables LOGNAME and USER, so it differs from |
679 `user-login-name' when running under `su'. | 671 `user-login-name' when running under `su'. |
680 */ | 672 */ |
681 ()) | 673 ()) |
682 { | 674 { |
683 struct passwd *pw = (struct passwd *) getpwuid (getuid ()); | 675 struct passwd *pw = getpwuid (getuid ()); |
684 /* #### - I believe this should return nil instead of "unknown" when pw==0 */ | 676 /* #### - I believe this should return nil instead of "unknown" when pw==0 */ |
685 | 677 |
686 #ifdef MSDOS | 678 #ifdef MSDOS |
687 /* We let the real user name default to "root" because that's quite | 679 /* We let the real user name default to "root" because that's quite |
688 accurate on MSDOG and because it lets Emacs find the init file. | 680 accurate on MSDOG and because it lets Emacs find the init file. |
742 } | 734 } |
743 | 735 |
744 /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ | 736 /* #### - Stig sez: this should return nil instead of "unknown" when pw==0 */ |
745 /* Ben sez: bad idea because it's likely to break something */ | 737 /* Ben sez: bad idea because it's likely to break something */ |
746 #ifndef AMPERSAND_FULL_NAME | 738 #ifndef AMPERSAND_FULL_NAME |
747 p = (char *) ((pw) ? USER_FULL_NAME : "unknown"); /* don't gettext */ | 739 p = ((pw) ? USER_FULL_NAME : "unknown"); /* don't gettext */ |
748 q = (char *) strchr ((char *) p, ','); | 740 q = strchr (p, ','); |
749 #else | 741 #else |
750 p = (char *) ((pw) ? USER_FULL_NAME : "unknown"); /* don't gettext */ | 742 p = ((pw) ? USER_FULL_NAME : "unknown"); /* don't gettext */ |
751 q = (char *) strchr ((char *) p, ','); | 743 q = strchr (p, ','); |
752 #endif | 744 #endif |
753 tem = ((!NILP (user) && !pw) | 745 tem = ((!NILP (user) && !pw) |
754 ? Qnil | 746 ? Qnil |
755 : make_ext_string ((unsigned char *) p, (q ? q - p : strlen (p)), | 747 : make_ext_string ((Extbyte *) p, (q ? q - p : strlen (p)), |
756 FORMAT_OS)); | 748 FORMAT_OS)); |
757 | 749 |
758 #ifdef AMPERSAND_FULL_NAME | 750 #ifdef AMPERSAND_FULL_NAME |
759 if (!NILP (tem)) | 751 if (!NILP (tem)) |
760 { | 752 { |
813 resolution finer than a second. | 805 resolution finer than a second. |
814 */ | 806 */ |
815 ()) | 807 ()) |
816 { | 808 { |
817 EMACS_TIME t; | 809 EMACS_TIME t; |
818 Lisp_Object result[3]; | |
819 | 810 |
820 EMACS_GET_TIME (t); | 811 EMACS_GET_TIME (t); |
821 XSETINT (result[0], (EMACS_SECS (t) >> 16) & 0xffff); | 812 return list3 (make_int ((EMACS_SECS (t) >> 16) & 0xffff), |
822 XSETINT (result[1], (EMACS_SECS (t) >> 0) & 0xffff); | 813 make_int ((EMACS_SECS (t) >> 0) & 0xffff), |
823 XSETINT (result[2], EMACS_USECS (t)); | 814 make_int (EMACS_USECS (t))); |
824 | |
825 return Flist (3, result); | |
826 } | 815 } |
827 | 816 |
828 DEFUN ("current-process-time", Fcurrent_process_time, 0, 0, 0, /* | 817 DEFUN ("current-process-time", Fcurrent_process_time, 0, 0, 0, /* |
829 Return the amount of time used by this XEmacs process so far. | 818 Return the amount of time used by this XEmacs process so far. |
830 The return value is a list of three floating-point numbers, expressing | 819 The return value is a list of three floating-point numbers, expressing |
855 get_process_times (&user, &sys, &real); | 844 get_process_times (&user, &sys, &real); |
856 return list3 (make_float (user), make_float (sys), make_float (real)); | 845 return list3 (make_float (user), make_float (sys), make_float (real)); |
857 } | 846 } |
858 | 847 |
859 | 848 |
849 int lisp_to_time (Lisp_Object specified_time, time_t *result); | |
860 int | 850 int |
861 lisp_to_time (Lisp_Object specified_time, time_t *result) | 851 lisp_to_time (Lisp_Object specified_time, time_t *result) |
862 { | 852 { |
853 Lisp_Object high, low; | |
854 | |
863 if (NILP (specified_time)) | 855 if (NILP (specified_time)) |
864 return time (result) != -1; | 856 return time (result) != -1; |
865 else | 857 |
866 { | 858 CHECK_CONS (specified_time); |
867 Lisp_Object high, low; | 859 high = XCAR (specified_time); |
868 high = Fcar (specified_time); | 860 low = XCDR (specified_time); |
869 CHECK_INT (high); | 861 if (CONSP (low)) |
870 low = Fcdr (specified_time); | 862 low = XCAR (low); |
871 if (CONSP (low)) | 863 CHECK_INT (high); |
872 low = XCAR (low); | 864 CHECK_INT (low); |
873 CHECK_INT (low); | 865 *result = (XINT (high) << 16) + (XINT (low) & 0xffff); |
874 *result = (XINT (high) << 16) + (XINT (low) & 0xffff); | 866 return *result >> 16 == XINT (high); |
875 return *result >> 16 == XINT (high); | 867 } |
876 } | 868 |
877 } | 869 Lisp_Object time_to_lisp (time_t the_time); |
878 | |
879 Lisp_Object | 870 Lisp_Object |
880 time_to_lisp (time_t the_time) | 871 time_to_lisp (time_t the_time) |
881 { | 872 { |
882 unsigned int item = (unsigned int) the_time; | 873 unsigned int item = (unsigned int) the_time; |
883 return Fcons (make_int (item >> 16), make_int (item & 0xffff)); | 874 return Fcons (make_int (item >> 16), make_int (item & 0xffff)); |
933 characters appearing in the day and month names may be incorrect. | 924 characters appearing in the day and month names may be incorrect. |
934 */ | 925 */ |
935 (format_string, _time)) | 926 (format_string, _time)) |
936 { | 927 { |
937 time_t value; | 928 time_t value; |
938 int size; | 929 size_t size; |
939 | 930 |
940 CHECK_STRING (format_string); | 931 CHECK_STRING (format_string); |
941 | 932 |
942 if (! lisp_to_time (_time, &value)) | 933 if (! lisp_to_time (_time, &value)) |
943 error ("Invalid time specification"); | 934 error ("Invalid time specification"); |
1008 DEFUN ("encode-time", Fencode_time, 6, MANY, 0, /* | 999 DEFUN ("encode-time", Fencode_time, 6, MANY, 0, /* |
1009 Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. | 1000 Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. |
1010 This is the reverse operation of `decode-time', which see. | 1001 This is the reverse operation of `decode-time', which see. |
1011 ZONE defaults to the current time zone rule. This can | 1002 ZONE defaults to the current time zone rule. This can |
1012 be a string (as from `set-time-zone-rule'), or it can be a list | 1003 be a string (as from `set-time-zone-rule'), or it can be a list |
1013 (as from `current-time-zone') or an integer (as from `decode-time') | 1004 \(as from `current-time-zone') or an integer (as from `decode-time') |
1014 applied without consideration for daylight savings time. | 1005 applied without consideration for daylight savings time. |
1015 | 1006 |
1016 You can pass more than 7 arguments; then the first six arguments | 1007 You can pass more than 7 arguments; then the first six arguments |
1017 are used as SECOND through YEAR, and the *last* argument is used as ZONE. | 1008 are used as SECOND through YEAR, and the *last* argument is used as ZONE. |
1018 The intervening arguments are ignored. | 1009 The intervening arguments are ignored. |
1153 the data it can't find. | 1144 the data it can't find. |
1154 */ | 1145 */ |
1155 (specified_time)) | 1146 (specified_time)) |
1156 { | 1147 { |
1157 time_t value; | 1148 time_t value; |
1158 struct tm *t; | 1149 struct tm *t = NULL; |
1159 | 1150 |
1160 if (lisp_to_time (specified_time, &value) | 1151 if (lisp_to_time (specified_time, &value) |
1161 && (t = gmtime (&value)) != 0) | 1152 && (t = gmtime (&value)) != 0) |
1162 { | 1153 { |
1163 struct tm gmt; | 1154 struct tm gmt = *t; /* Make a copy, in case localtime modifies *t. */ |
1164 long offset; | 1155 long offset; |
1165 char *s, buf[6]; | 1156 char *s, buf[6]; |
1166 | 1157 |
1167 gmt = *t; /* Make a copy, in case localtime modifies *t. */ | |
1168 t = localtime (&value); | 1158 t = localtime (&value); |
1169 offset = difftm (t, &gmt); | 1159 offset = difftm (t, &gmt); |
1170 s = 0; | 1160 s = 0; |
1171 #ifdef HAVE_TM_ZONE | 1161 #ifdef HAVE_TM_ZONE |
1172 if (t->tm_zone) | 1162 if (t->tm_zone) |
1193 #ifdef LOCALTIME_CACHE | 1183 #ifdef LOCALTIME_CACHE |
1194 | 1184 |
1195 /* These two values are known to load tz files in buggy implementations, | 1185 /* These two values are known to load tz files in buggy implementations, |
1196 i.e. Solaris 1 executables running under either Solaris 1 or Solaris 2. | 1186 i.e. Solaris 1 executables running under either Solaris 1 or Solaris 2. |
1197 Their values shouldn't matter in non-buggy implementations. | 1187 Their values shouldn't matter in non-buggy implementations. |
1198 We don't use string literals for these strings, | 1188 We don't use string literals for these strings, |
1199 since if a string in the environment is in readonly | 1189 since if a string in the environment is in readonly |
1200 storage, it runs afoul of bugs in SVR4 and Solaris 2.3. | 1190 storage, it runs afoul of bugs in SVR4 and Solaris 2.3. |
1201 See Sun bugs 1113095 and 1114114, ``Timezone routines | 1191 See Sun bugs 1113095 and 1114114, ``Timezone routines |
1202 improperly modify environment''. */ | 1192 improperly modify environment''. */ |
1203 | 1193 |
1671 struct buffer *buf = current_buffer; | 1661 struct buffer *buf = current_buffer; |
1672 | 1662 |
1673 get_buffer_range_char (buf, start, end, &pos, &stop, 0); | 1663 get_buffer_range_char (buf, start, end, &pos, &stop, 0); |
1674 CHECK_STRING (table); | 1664 CHECK_STRING (table); |
1675 | 1665 |
1676 size = string_char_length (XSTRING (table)); | 1666 size = XSTRING_CHAR_LENGTH (table); |
1677 | 1667 |
1678 cnt = 0; | 1668 cnt = 0; |
1679 mc_count = begin_multiple_change (buf, pos, stop); | 1669 mc_count = begin_multiple_change (buf, pos, stop); |
1680 for (; pos < stop; pos++) | 1670 for (; pos < stop; pos++) |
1681 { | 1671 { |
2018 | 2008 |
2019 void | 2009 void |
2020 transpose_markers (Bufpos start1, Bufpos end1, Bufpos start2, Bufpos end2) | 2010 transpose_markers (Bufpos start1, Bufpos end1, Bufpos start2, Bufpos end2) |
2021 { | 2011 { |
2022 Charcount amt1, amt2, diff; | 2012 Charcount amt1, amt2, diff; |
2023 Bufpos mpos; | |
2024 Lisp_Object marker; | 2013 Lisp_Object marker; |
2025 struct buffer *buf = current_buffer; | 2014 struct buffer *buf = current_buffer; |
2026 | 2015 |
2027 /* Update point as if it were a marker. */ | 2016 /* Update point as if it were a marker. */ |
2028 if (BUF_PT (buf) < start1) | 2017 if (BUF_PT (buf) < start1) |
2052 amt2 = (end1 - start1) + (start2 - end1); | 2041 amt2 = (end1 - start1) + (start2 - end1); |
2053 | 2042 |
2054 for (marker = BUF_MARKERS (buf); !NILP (marker); | 2043 for (marker = BUF_MARKERS (buf); !NILP (marker); |
2055 marker = XMARKER (marker)->chain) | 2044 marker = XMARKER (marker)->chain) |
2056 { | 2045 { |
2057 mpos = marker_position (marker); | 2046 Bufpos mpos = marker_position (marker); |
2058 if (mpos >= start1 && mpos < end2) | 2047 if (mpos >= start1 && mpos < end2) |
2059 { | 2048 { |
2060 if (mpos < end1) | 2049 if (mpos < end1) |
2061 mpos += amt1; | 2050 mpos += amt1; |
2062 else if (mpos < start2) | 2051 else if (mpos < start2) |
2141 DEFSUBR (Fregion_beginning); | 2130 DEFSUBR (Fregion_beginning); |
2142 DEFSUBR (Fregion_end); | 2131 DEFSUBR (Fregion_end); |
2143 DEFSUBR (Fsave_excursion); | 2132 DEFSUBR (Fsave_excursion); |
2144 DEFSUBR (Fsave_current_buffer); | 2133 DEFSUBR (Fsave_current_buffer); |
2145 | 2134 |
2146 DEFSUBR (Fbufsize); | 2135 DEFSUBR (Fbuffer_size); |
2147 DEFSUBR (Fpoint_max); | 2136 DEFSUBR (Fpoint_max); |
2148 DEFSUBR (Fpoint_min); | 2137 DEFSUBR (Fpoint_min); |
2149 DEFSUBR (Fpoint_min_marker); | 2138 DEFSUBR (Fpoint_min_marker); |
2150 DEFSUBR (Fpoint_max_marker); | 2139 DEFSUBR (Fpoint_max_marker); |
2151 | 2140 |