Mercurial > hg > xemacs-beta
comparison src/fileio.c @ 5581:56144c8593a8
Mechanically change INT to FIXNUM in our sources.
src/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT (where it refers to non-bignum Lisp
integers) to FIXNUM in our sources. Done for the following
functions, enums, and macros: Lisp_Type_Int_Even,
Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(),
XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(),
EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to
MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to
NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT.
The EMACS_INT typedef was not changed, it does not describe
non-bignum Lisp integers.
Script that did the change available in
http://mid.gmane.org/20067.17650.181273.12014@parhasard.net .
modules/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers. See the src/ChangeLog entry for more details.
man/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (How Lisp Objects Are Represented in C):
* internals/internals.texi (Integers and Characters):
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Oct 2011 09:51:57 +0100 |
parents | 4dee0387b9de |
children | 65d65b52d608 |
comparison
equal
deleted
inserted
replaced
5580:a0e81357194e | 5581:56144c8593a8 |
---|---|
171 static Lisp_Object | 171 static Lisp_Object |
172 close_file_unwind (Lisp_Object fd) | 172 close_file_unwind (Lisp_Object fd) |
173 { | 173 { |
174 if (CONSP (fd)) | 174 if (CONSP (fd)) |
175 { | 175 { |
176 if (INTP (XCAR (fd))) | 176 if (FIXNUMP (XCAR (fd))) |
177 retry_close (XINT (XCAR (fd))); | 177 retry_close (XFIXNUM (XCAR (fd))); |
178 | 178 |
179 free_cons (fd); | 179 free_cons (fd); |
180 } | 180 } |
181 else | 181 else |
182 retry_close (XINT (fd)); | 182 retry_close (XFIXNUM (fd)); |
183 | 183 |
184 return Qnil; | 184 return Qnil; |
185 } | 185 } |
186 | 186 |
187 static Lisp_Object | 187 static Lisp_Object |
1849 newname = Fconcat (i, args); | 1849 newname = Fconcat (i, args); |
1850 NUNGCPRO; | 1850 NUNGCPRO; |
1851 } | 1851 } |
1852 | 1852 |
1853 if (NILP (ok_if_already_exists) | 1853 if (NILP (ok_if_already_exists) |
1854 || INTP (ok_if_already_exists)) | 1854 || FIXNUMP (ok_if_already_exists)) |
1855 barf_or_query_if_file_exists (newname, "copy to it", | 1855 barf_or_query_if_file_exists (newname, "copy to it", |
1856 INTP (ok_if_already_exists), &out_st); | 1856 FIXNUMP (ok_if_already_exists), &out_st); |
1857 else if (qxe_stat (XSTRING_DATA (newname), &out_st) < 0) | 1857 else if (qxe_stat (XSTRING_DATA (newname), &out_st) < 0) |
1858 out_st.st_mode = 0; | 1858 out_st.st_mode = 0; |
1859 | 1859 |
1860 ifd = qxe_interruptible_open (XSTRING_DATA (filename), | 1860 ifd = qxe_interruptible_open (XSTRING_DATA (filename), |
1861 O_RDONLY | OPEN_BINARY, 0); | 1861 O_RDONLY | OPEN_BINARY, 0); |
1862 if (ifd < 0) | 1862 if (ifd < 0) |
1863 report_file_error ("Opening input file", filename); | 1863 report_file_error ("Opening input file", filename); |
1864 | 1864 |
1865 record_unwind_protect (close_file_unwind, make_int (ifd)); | 1865 record_unwind_protect (close_file_unwind, make_fixnum (ifd)); |
1866 | 1866 |
1867 /* We can only copy regular files and symbolic links. Other files are not | 1867 /* We can only copy regular files and symbolic links. Other files are not |
1868 copyable by us. */ | 1868 copyable by us. */ |
1869 input_file_statable_p = (qxe_fstat (ifd, &st) >= 0); | 1869 input_file_statable_p = (qxe_fstat (ifd, &st) >= 0); |
1870 | 1870 |
1901 O_WRONLY | O_CREAT | O_TRUNC | OPEN_BINARY, CREAT_MODE); | 1901 O_WRONLY | O_CREAT | O_TRUNC | OPEN_BINARY, CREAT_MODE); |
1902 if (ofd < 0) | 1902 if (ofd < 0) |
1903 report_file_error ("Opening output file", newname); | 1903 report_file_error ("Opening output file", newname); |
1904 | 1904 |
1905 { | 1905 { |
1906 Lisp_Object ofd_locative = noseeum_cons (make_int (ofd), Qnil); | 1906 Lisp_Object ofd_locative = noseeum_cons (make_fixnum (ofd), Qnil); |
1907 | 1907 |
1908 record_unwind_protect (close_file_unwind, ofd_locative); | 1908 record_unwind_protect (close_file_unwind, ofd_locative); |
1909 | 1909 |
1910 while ((n = read_allowing_quit (ifd, buf, sizeof (buf))) > 0) | 1910 while ((n = read_allowing_quit (ifd, buf, sizeof (buf))) > 0) |
1911 { | 1911 { |
2089 newname = Fconcat (i, args); | 2089 newname = Fconcat (i, args); |
2090 NUNGCPRO; | 2090 NUNGCPRO; |
2091 } | 2091 } |
2092 | 2092 |
2093 if (NILP (ok_if_already_exists) | 2093 if (NILP (ok_if_already_exists) |
2094 || INTP (ok_if_already_exists)) | 2094 || FIXNUMP (ok_if_already_exists)) |
2095 barf_or_query_if_file_exists (newname, "rename to it", | 2095 barf_or_query_if_file_exists (newname, "rename to it", |
2096 INTP (ok_if_already_exists), 0); | 2096 FIXNUMP (ok_if_already_exists), 0); |
2097 | 2097 |
2098 /* We have configure check for rename() and emulate using | 2098 /* We have configure check for rename() and emulate using |
2099 link()/unlink() if necessary. */ | 2099 link()/unlink() if necessary. */ |
2100 if (0 > qxe_rename (XSTRING_DATA (filename), XSTRING_DATA (newname))) | 2100 if (0 > qxe_rename (XSTRING_DATA (filename), XSTRING_DATA (newname))) |
2101 { | 2101 { |
2150 if (!NILP (handler)) | 2150 if (!NILP (handler)) |
2151 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, filename, | 2151 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, filename, |
2152 newname, ok_if_already_exists)); | 2152 newname, ok_if_already_exists)); |
2153 | 2153 |
2154 if (NILP (ok_if_already_exists) | 2154 if (NILP (ok_if_already_exists) |
2155 || INTP (ok_if_already_exists)) | 2155 || FIXNUMP (ok_if_already_exists)) |
2156 barf_or_query_if_file_exists (newname, "make it a new name", | 2156 barf_or_query_if_file_exists (newname, "make it a new name", |
2157 INTP (ok_if_already_exists), 0); | 2157 FIXNUMP (ok_if_already_exists), 0); |
2158 /* #### Emacs 20.6 contains an implementation of link() in w32.c. | 2158 /* #### Emacs 20.6 contains an implementation of link() in w32.c. |
2159 Need to port. */ | 2159 Need to port. */ |
2160 #ifndef HAVE_LINK | 2160 #ifndef HAVE_LINK |
2161 signal_error_2 (Qunimplemented, "Adding new name", filename, newname); | 2161 signal_error_2 (Qunimplemented, "Adding new name", filename, newname); |
2162 #else /* HAVE_LINK */ | 2162 #else /* HAVE_LINK */ |
2215 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, | 2215 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, |
2216 linkname, ok_if_already_exists)); | 2216 linkname, ok_if_already_exists)); |
2217 | 2217 |
2218 #ifdef HAVE_SYMLINK | 2218 #ifdef HAVE_SYMLINK |
2219 if (NILP (ok_if_already_exists) | 2219 if (NILP (ok_if_already_exists) |
2220 || INTP (ok_if_already_exists)) | 2220 || FIXNUMP (ok_if_already_exists)) |
2221 barf_or_query_if_file_exists (linkname, "make it a link", | 2221 barf_or_query_if_file_exists (linkname, "make it a link", |
2222 INTP (ok_if_already_exists), 0); | 2222 FIXNUMP (ok_if_already_exists), 0); |
2223 | 2223 |
2224 qxe_unlink (XSTRING_DATA (linkname)); | 2224 qxe_unlink (XSTRING_DATA (linkname)); |
2225 if (0 > qxe_symlink (XSTRING_DATA (filename), | 2225 if (0 > qxe_symlink (XSTRING_DATA (filename), |
2226 XSTRING_DATA (linkname))) | 2226 XSTRING_DATA (linkname))) |
2227 { | 2227 { |
2744 if (check_executable (abspath)) | 2744 if (check_executable (abspath)) |
2745 st.st_mode |= S_IEXEC; | 2745 st.st_mode |= S_IEXEC; |
2746 #endif /* WIN32_NATIVE */ | 2746 #endif /* WIN32_NATIVE */ |
2747 #endif /* 0 */ | 2747 #endif /* 0 */ |
2748 | 2748 |
2749 return make_int (st.st_mode & 07777); | 2749 return make_fixnum (st.st_mode & 07777); |
2750 } | 2750 } |
2751 | 2751 |
2752 DEFUN ("set-file-modes", Fset_file_modes, 2, 2, 0, /* | 2752 DEFUN ("set-file-modes", Fset_file_modes, 2, 2, 0, /* |
2753 Set mode bits of file named FILENAME to MODE (an integer). | 2753 Set mode bits of file named FILENAME to MODE (an integer). |
2754 Only the 12 low bits of MODE are used. | 2754 Only the 12 low bits of MODE are used. |
2762 | 2762 |
2763 GCPRO1 (current_buffer->directory); | 2763 GCPRO1 (current_buffer->directory); |
2764 abspath = Fexpand_file_name (filename, current_buffer->directory); | 2764 abspath = Fexpand_file_name (filename, current_buffer->directory); |
2765 UNGCPRO; | 2765 UNGCPRO; |
2766 | 2766 |
2767 CHECK_INT (mode); | 2767 CHECK_FIXNUM (mode); |
2768 | 2768 |
2769 /* If the file name has special constructs in it, | 2769 /* If the file name has special constructs in it, |
2770 call the corresponding file handler. */ | 2770 call the corresponding file handler. */ |
2771 GCPRO1 (abspath); | 2771 GCPRO1 (abspath); |
2772 handler = Ffind_file_name_handler (abspath, Qset_file_modes); | 2772 handler = Ffind_file_name_handler (abspath, Qset_file_modes); |
2773 UNGCPRO; | 2773 UNGCPRO; |
2774 if (!NILP (handler)) | 2774 if (!NILP (handler)) |
2775 return call3 (handler, Qset_file_modes, abspath, mode); | 2775 return call3 (handler, Qset_file_modes, abspath, mode); |
2776 | 2776 |
2777 if (qxe_chmod (XSTRING_DATA (abspath), XINT (mode)) < 0) | 2777 if (qxe_chmod (XSTRING_DATA (abspath), XFIXNUM (mode)) < 0) |
2778 report_file_error ("Doing chmod", abspath); | 2778 report_file_error ("Doing chmod", abspath); |
2779 | 2779 |
2780 return Qnil; | 2780 return Qnil; |
2781 } | 2781 } |
2782 | 2782 |
2787 to that bit enabled. Only the low 9 bits are used. | 2787 to that bit enabled. Only the low 9 bits are used. |
2788 This setting is inherited by subprocesses. | 2788 This setting is inherited by subprocesses. |
2789 */ | 2789 */ |
2790 (mode)) | 2790 (mode)) |
2791 { | 2791 { |
2792 CHECK_INT (mode); | 2792 CHECK_FIXNUM (mode); |
2793 | 2793 |
2794 umask ((~ XINT (mode)) & 0777); | 2794 umask ((~ XFIXNUM (mode)) & 0777); |
2795 | 2795 |
2796 return Qnil; | 2796 return Qnil; |
2797 } | 2797 } |
2798 | 2798 |
2799 DEFUN ("default-file-modes", Fdefault_file_modes, 0, 0, 0, /* | 2799 DEFUN ("default-file-modes", Fdefault_file_modes, 0, 0, 0, /* |
2807 int mode; | 2807 int mode; |
2808 | 2808 |
2809 mode = umask (0); | 2809 mode = umask (0); |
2810 umask (mode); | 2810 umask (mode); |
2811 | 2811 |
2812 return make_int ((~ mode) & 0777); | 2812 return make_fixnum ((~ mode) & 0777); |
2813 } | 2813 } |
2814 | 2814 |
2815 DEFUN ("unix-sync", Funix_sync, 0, 0, "", /* | 2815 DEFUN ("unix-sync", Funix_sync, 0, 0, "", /* |
2816 Tell Unix to finish all pending disk updates. | 2816 Tell Unix to finish all pending disk updates. |
2817 */ | 2817 */ |
2971 } | 2971 } |
2972 } | 2972 } |
2973 #endif /* S_IFREG */ | 2973 #endif /* S_IFREG */ |
2974 | 2974 |
2975 if (!NILP (start)) | 2975 if (!NILP (start)) |
2976 CHECK_INT (start); | 2976 CHECK_FIXNUM (start); |
2977 else | 2977 else |
2978 start = Qzero; | 2978 start = Qzero; |
2979 | 2979 |
2980 if (!NILP (end)) | 2980 if (!NILP (end)) |
2981 CHECK_INT (end); | 2981 CHECK_FIXNUM (end); |
2982 | 2982 |
2983 if (fd < 0) | 2983 if (fd < 0) |
2984 { | 2984 { |
2985 if ((fd = qxe_interruptible_open (XSTRING_DATA (filename), | 2985 if ((fd = qxe_interruptible_open (XSTRING_DATA (filename), |
2986 O_RDONLY | OPEN_BINARY, 0)) < 0) | 2986 O_RDONLY | OPEN_BINARY, 0)) < 0) |
2989 | 2989 |
2990 /* Replacement should preserve point as it preserves markers. */ | 2990 /* Replacement should preserve point as it preserves markers. */ |
2991 if (!NILP (replace)) | 2991 if (!NILP (replace)) |
2992 record_unwind_protect (restore_point_unwind, Fpoint_marker (Qnil, Qnil)); | 2992 record_unwind_protect (restore_point_unwind, Fpoint_marker (Qnil, Qnil)); |
2993 | 2993 |
2994 record_unwind_protect (close_file_unwind, make_int (fd)); | 2994 record_unwind_protect (close_file_unwind, make_fixnum (fd)); |
2995 | 2995 |
2996 /* Supposedly happens on VMS. */ | 2996 /* Supposedly happens on VMS. */ |
2997 if (st.st_size < 0) | 2997 if (st.st_size < 0) |
2998 signal_error (Qfile_error, "File size is negative", Qunbound); | 2998 signal_error (Qfile_error, "File size is negative", Qunbound); |
2999 | 2999 |
3000 if (NILP (end)) | 3000 if (NILP (end)) |
3001 { | 3001 { |
3002 if (!not_regular) | 3002 if (!not_regular) |
3003 { | 3003 { |
3004 end = make_int (st.st_size); | 3004 end = make_fixnum (st.st_size); |
3005 if (XINT (end) != st.st_size) | 3005 if (XFIXNUM (end) != st.st_size) |
3006 out_of_memory ("Maximum buffer size exceeded", Qunbound); | 3006 out_of_memory ("Maximum buffer size exceeded", Qunbound); |
3007 } | 3007 } |
3008 } | 3008 } |
3009 | 3009 |
3010 /* If requested, replace the accessible part of the buffer | 3010 /* If requested, replace the accessible part of the buffer |
3140 (same_at_end + st.st_size - BUF_ZV (buf)); | 3140 (same_at_end + st.st_size - BUF_ZV (buf)); |
3141 if (overlap > 0) | 3141 if (overlap > 0) |
3142 same_at_end += overlap; | 3142 same_at_end += overlap; |
3143 | 3143 |
3144 /* Arrange to read only the nonmatching middle part of the file. */ | 3144 /* Arrange to read only the nonmatching middle part of the file. */ |
3145 start = make_int (same_at_start - BUF_BEGV (buf)); | 3145 start = make_fixnum (same_at_start - BUF_BEGV (buf)); |
3146 end = make_int (st.st_size - (BUF_ZV (buf) - same_at_end)); | 3146 end = make_fixnum (st.st_size - (BUF_ZV (buf) - same_at_end)); |
3147 | 3147 |
3148 buffer_delete_range (buf, same_at_start, same_at_end, | 3148 buffer_delete_range (buf, same_at_start, same_at_end, |
3149 !NILP (visit) ? INSDEL_NO_LOCKING : 0); | 3149 !NILP (visit) ? INSDEL_NO_LOCKING : 0); |
3150 /* Insert from the file at the proper position. */ | 3150 /* Insert from the file at the proper position. */ |
3151 BUF_SET_PT (buf, same_at_start); | 3151 BUF_SET_PT (buf, same_at_start); |
3152 } | 3152 } |
3153 } | 3153 } |
3154 | 3154 |
3155 if (!not_regular) | 3155 if (!not_regular) |
3156 { | 3156 { |
3157 total = XINT (end) - XINT (start); | 3157 total = XFIXNUM (end) - XFIXNUM (start); |
3158 | 3158 |
3159 /* Make sure point-max won't overflow after this insertion. */ | 3159 /* Make sure point-max won't overflow after this insertion. */ |
3160 if (total != XINT (make_int (total))) | 3160 if (total != XFIXNUM (make_fixnum (total))) |
3161 out_of_memory ("Maximum buffer size exceeded", Qunbound); | 3161 out_of_memory ("Maximum buffer size exceeded", Qunbound); |
3162 } | 3162 } |
3163 else | 3163 else |
3164 /* For a special file, all we can do is guess. The value of -1 | 3164 /* For a special file, all we can do is guess. The value of -1 |
3165 will make the stream functions read as much as possible. */ | 3165 will make the stream functions read as much as possible. */ |
3166 total = -1; | 3166 total = -1; |
3167 | 3167 |
3168 if (XINT (start) != 0 | 3168 if (XFIXNUM (start) != 0 |
3169 /* why was this here? asked jwz. The reason is that the replace-mode | 3169 /* why was this here? asked jwz. The reason is that the replace-mode |
3170 connivings above will normally put the file pointer other than | 3170 connivings above will normally put the file pointer other than |
3171 where it should be. */ | 3171 where it should be. */ |
3172 || (!NILP (replace) && do_speedy_insert)) | 3172 || (!NILP (replace) && do_speedy_insert)) |
3173 { | 3173 { |
3174 if (lseek (fd, XINT (start), 0) < 0) | 3174 if (lseek (fd, XFIXNUM (start), 0) < 0) |
3175 report_file_error ("Setting file position", filename); | 3175 report_file_error ("Setting file position", filename); |
3176 } | 3176 } |
3177 | 3177 |
3178 { | 3178 { |
3179 Charbpos cur_point = BUF_PT (buf); | 3179 Charbpos cur_point = BUF_PT (buf); |
3255 ignored. */ | 3255 ignored. */ |
3256 if (!NILP (Ffboundp (Qcompute_buffer_file_truename))) | 3256 if (!NILP (Ffboundp (Qcompute_buffer_file_truename))) |
3257 call1 (Qcompute_buffer_file_truename, wrap_buffer (buf)); | 3257 call1 (Qcompute_buffer_file_truename, wrap_buffer (buf)); |
3258 BUF_SAVE_MODIFF (buf) = BUF_MODIFF (buf); | 3258 BUF_SAVE_MODIFF (buf) = BUF_MODIFF (buf); |
3259 buf->auto_save_modified = BUF_MODIFF (buf); | 3259 buf->auto_save_modified = BUF_MODIFF (buf); |
3260 buf->saved_size = make_int (BUF_SIZE (buf)); | 3260 buf->saved_size = make_fixnum (BUF_SIZE (buf)); |
3261 #ifdef CLASH_DETECTION | 3261 #ifdef CLASH_DETECTION |
3262 if (!NILP (buf->file_truename)) | 3262 if (!NILP (buf->file_truename)) |
3263 unlock_file (buf->file_truename); | 3263 unlock_file (buf->file_truename); |
3264 unlock_file (filename); | 3264 unlock_file (filename); |
3265 #endif /* CLASH_DETECTION */ | 3265 #endif /* CLASH_DETECTION */ |
3275 } | 3275 } |
3276 | 3276 |
3277 /* Decode file format */ | 3277 /* Decode file format */ |
3278 if (inserted > 0 && !UNBOUNDP (XSYMBOL_FUNCTION (Qformat_decode))) | 3278 if (inserted > 0 && !UNBOUNDP (XSYMBOL_FUNCTION (Qformat_decode))) |
3279 { | 3279 { |
3280 Lisp_Object insval = call3 (Qformat_decode, Qnil, make_int (inserted), | 3280 Lisp_Object insval = call3 (Qformat_decode, Qnil, make_fixnum (inserted), |
3281 visit); | 3281 visit); |
3282 CHECK_INT (insval); | 3282 CHECK_FIXNUM (insval); |
3283 inserted = XINT (insval); | 3283 inserted = XFIXNUM (insval); |
3284 } | 3284 } |
3285 | 3285 |
3286 if (inserted > 0) | 3286 if (inserted > 0) |
3287 { | 3287 { |
3288 GC_EXTERNAL_LIST_LOOP_2 (p, Vafter_insert_file_functions) | 3288 GC_EXTERNAL_LIST_LOOP_2 (p, Vafter_insert_file_functions) |
3289 { | 3289 { |
3290 Lisp_Object insval = call1 (p, make_int (inserted)); | 3290 Lisp_Object insval = call1 (p, make_fixnum (inserted)); |
3291 if (!NILP (insval)) | 3291 if (!NILP (insval)) |
3292 { | 3292 { |
3293 check_integer_range (insval, Qzero, make_int (EMACS_INT_MAX)); | 3293 check_integer_range (insval, Qzero, make_fixnum (MOST_POSITIVE_FIXNUM)); |
3294 inserted = XINT (insval); | 3294 inserted = XFIXNUM (insval); |
3295 } | 3295 } |
3296 } | 3296 } |
3297 END_GC_EXTERNAL_LIST_LOOP (p); | 3297 END_GC_EXTERNAL_LIST_LOOP (p); |
3298 } | 3298 } |
3299 | 3299 |
3300 UNGCPRO; | 3300 UNGCPRO; |
3301 | 3301 |
3302 if (!NILP (val)) | 3302 if (!NILP (val)) |
3303 return (val); | 3303 return (val); |
3304 else | 3304 else |
3305 return (list2 (filename, make_int (inserted))); | 3305 return (list2 (filename, make_fixnum (inserted))); |
3306 } | 3306 } |
3307 | 3307 |
3308 | 3308 |
3309 static int a_write (Lisp_Object outstream, Lisp_Object instream, int pos, | 3309 static int a_write (Lisp_Object outstream, Lisp_Object instream, int pos, |
3310 Lisp_Object *annot); | 3310 Lisp_Object *annot); |
3421 Lisp_Object val = call8 (handler, Qwrite_region, start, end, | 3421 Lisp_Object val = call8 (handler, Qwrite_region, start, end, |
3422 filename, append, visit, lockname, codesys); | 3422 filename, append, visit, lockname, codesys); |
3423 if (visiting) | 3423 if (visiting) |
3424 { | 3424 { |
3425 BUF_SAVE_MODIFF (current_buffer) = BUF_MODIFF (current_buffer); | 3425 BUF_SAVE_MODIFF (current_buffer) = BUF_MODIFF (current_buffer); |
3426 current_buffer->saved_size = make_int (BUF_SIZE (current_buffer)); | 3426 current_buffer->saved_size = make_fixnum (BUF_SIZE (current_buffer)); |
3427 current_buffer->filename = visit_file; | 3427 current_buffer->filename = visit_file; |
3428 MARK_MODELINE_CHANGED; | 3428 MARK_MODELINE_CHANGED; |
3429 } | 3429 } |
3430 NUNGCPRO; | 3430 NUNGCPRO; |
3431 UNGCPRO; | 3431 UNGCPRO; |
3479 #endif /* CLASH_DETECTION */ | 3479 #endif /* CLASH_DETECTION */ |
3480 report_file_error ("Opening output file", filename); | 3480 report_file_error ("Opening output file", filename); |
3481 } | 3481 } |
3482 | 3482 |
3483 { | 3483 { |
3484 Lisp_Object desc_locative = Fcons (make_int (desc), Qnil); | 3484 Lisp_Object desc_locative = Fcons (make_fixnum (desc), Qnil); |
3485 Lisp_Object instream = Qnil, outstream = Qnil; | 3485 Lisp_Object instream = Qnil, outstream = Qnil; |
3486 struct gcpro nngcpro1, nngcpro2; | 3486 struct gcpro nngcpro1, nngcpro2; |
3487 NNGCPRO2 (instream, outstream); | 3487 NNGCPRO2 (instream, outstream); |
3488 | 3488 |
3489 record_unwind_protect (close_file_unwind, desc_locative); | 3489 record_unwind_protect (close_file_unwind, desc_locative); |
3598 } | 3598 } |
3599 | 3599 |
3600 if (visiting) | 3600 if (visiting) |
3601 { | 3601 { |
3602 BUF_SAVE_MODIFF (current_buffer) = BUF_MODIFF (current_buffer); | 3602 BUF_SAVE_MODIFF (current_buffer) = BUF_MODIFF (current_buffer); |
3603 current_buffer->saved_size = make_int (BUF_SIZE (current_buffer)); | 3603 current_buffer->saved_size = make_fixnum (BUF_SIZE (current_buffer)); |
3604 current_buffer->filename = visit_file; | 3604 current_buffer->filename = visit_file; |
3605 MARK_MODELINE_CHANGED; | 3605 MARK_MODELINE_CHANGED; |
3606 } | 3606 } |
3607 else if (quietly) | 3607 else if (quietly) |
3608 { | 3608 { |
3666 Reset START and END from the buffer bounds | 3666 Reset START and END from the buffer bounds |
3667 and discard all previous annotations because they should have | 3667 and discard all previous annotations because they should have |
3668 been dealt with by this function. */ | 3668 been dealt with by this function. */ |
3669 if (current_buffer != given_buffer) | 3669 if (current_buffer != given_buffer) |
3670 { | 3670 { |
3671 start = make_int (BUF_BEGV (current_buffer)); | 3671 start = make_fixnum (BUF_BEGV (current_buffer)); |
3672 end = make_int (BUF_ZV (current_buffer)); | 3672 end = make_fixnum (BUF_ZV (current_buffer)); |
3673 annotations = Qnil; | 3673 annotations = Qnil; |
3674 } | 3674 } |
3675 Flength (res); /* Check basic validity of return value */ | 3675 Flength (res); /* Check basic validity of return value */ |
3676 annotations = list_merge (annotations, res, check_lss_key_car, Qnil, | 3676 annotations = list_merge (annotations, res, check_lss_key_car, Qnil, |
3677 Qnil); | 3677 Qnil); |
3698 Vwrite_region_annotations_so_far = annotations; | 3698 Vwrite_region_annotations_so_far = annotations; |
3699 res = call4 (Qformat_annotate_function, Fcar (p), start, end, | 3699 res = call4 (Qformat_annotate_function, Fcar (p), start, end, |
3700 original_buffer); | 3700 original_buffer); |
3701 if (current_buffer != given_buffer) | 3701 if (current_buffer != given_buffer) |
3702 { | 3702 { |
3703 start = make_int (BUF_BEGV (current_buffer)); | 3703 start = make_fixnum (BUF_BEGV (current_buffer)); |
3704 end = make_int (BUF_ZV (current_buffer)); | 3704 end = make_fixnum (BUF_ZV (current_buffer)); |
3705 annotations = Qnil; | 3705 annotations = Qnil; |
3706 } | 3706 } |
3707 Flength (res); | 3707 Flength (res); |
3708 annotations = list_merge (annotations, res, check_lss_key_car, Qnil, | 3708 annotations = list_merge (annotations, res, check_lss_key_car, Qnil, |
3709 Qnil); | 3709 Qnil); |
3740 Lstream *outstr = XLSTREAM (outstream); | 3740 Lstream *outstr = XLSTREAM (outstream); |
3741 | 3741 |
3742 while (LISTP (*annot)) | 3742 while (LISTP (*annot)) |
3743 { | 3743 { |
3744 tem = Fcar_safe (Fcar (*annot)); | 3744 tem = Fcar_safe (Fcar (*annot)); |
3745 if (INTP (tem)) | 3745 if (FIXNUMP (tem)) |
3746 nextpos = XINT (tem); | 3746 nextpos = XFIXNUM (tem); |
3747 else | 3747 else |
3748 nextpos = INT_MAX; | 3748 nextpos = INT_MAX; |
3749 #ifdef MULE | 3749 #ifdef MULE |
3750 /* If there are annotations left and we have Mule, then we | 3750 /* If there are annotations left and we have Mule, then we |
3751 have to do the I/O one ichar at a time so we can | 3751 have to do the I/O one ichar at a time so we can |
3983 if (preparing_for_armageddon) | 3983 if (preparing_for_armageddon) |
3984 return Qnil; | 3984 return Qnil; |
3985 clear_echo_area (selected_frame (), Qauto_saving, 1); | 3985 clear_echo_area (selected_frame (), Qauto_saving, 1); |
3986 Fding (Qt, Qauto_save_error, Qnil); | 3986 Fding (Qt, Qauto_save_error, Qnil); |
3987 message ("Auto-saving...error for %s", XSTRING_DATA (current_buffer->name)); | 3987 message ("Auto-saving...error for %s", XSTRING_DATA (current_buffer->name)); |
3988 Fsleep_for (make_int (1)); | 3988 Fsleep_for (make_fixnum (1)); |
3989 message ("Auto-saving...error!for %s", XSTRING_DATA (current_buffer->name)); | 3989 message ("Auto-saving...error!for %s", XSTRING_DATA (current_buffer->name)); |
3990 Fsleep_for (make_int (1)); | 3990 Fsleep_for (make_fixnum (1)); |
3991 message ("Auto-saving...error for %s", XSTRING_DATA (current_buffer->name)); | 3991 message ("Auto-saving...error for %s", XSTRING_DATA (current_buffer->name)); |
3992 Fsleep_for (make_int (1)); | 3992 Fsleep_for (make_fixnum (1)); |
3993 return Qnil; | 3993 return Qnil; |
3994 } | 3994 } |
3995 | 3995 |
3996 static Lisp_Object | 3996 static Lisp_Object |
3997 auto_save_1 (Lisp_Object UNUSED (ignored)) | 3997 auto_save_1 (Lisp_Object UNUSED (ignored)) |
4053 | 4053 |
4054 | 4054 |
4055 static Lisp_Object | 4055 static Lisp_Object |
4056 do_auto_save_unwind (Lisp_Object fd) | 4056 do_auto_save_unwind (Lisp_Object fd) |
4057 { | 4057 { |
4058 retry_close (XINT (fd)); | 4058 retry_close (XFIXNUM (fd)); |
4059 return (fd); | 4059 return (fd); |
4060 } | 4060 } |
4061 | 4061 |
4062 /* Fdo_auto_save() checks whether a GC is in progress when it is called, | 4062 /* Fdo_auto_save() checks whether a GC is in progress when it is called, |
4063 and if so, tries to avoid touching lisp objects. | 4063 and if so, tries to avoid touching lisp objects. |
4145 and file changed since last real save. */ | 4145 and file changed since last real save. */ |
4146 if (STRINGP (b->auto_save_file_name) | 4146 if (STRINGP (b->auto_save_file_name) |
4147 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) | 4147 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) |
4148 && b->auto_save_modified < BUF_MODIFF (b) | 4148 && b->auto_save_modified < BUF_MODIFF (b) |
4149 /* -1 means we've turned off autosaving for a while--see below. */ | 4149 /* -1 means we've turned off autosaving for a while--see below. */ |
4150 && XINT (b->saved_size) >= 0 | 4150 && XFIXNUM (b->saved_size) >= 0 |
4151 && (do_handled_files | 4151 && (do_handled_files |
4152 || NILP (Ffind_file_name_handler (b->auto_save_file_name, | 4152 || NILP (Ffind_file_name_handler (b->auto_save_file_name, |
4153 Qwrite_region)))) | 4153 Qwrite_region)))) |
4154 { | 4154 { |
4155 EMACS_TIME before_time, after_time; | 4155 EMACS_TIME before_time, after_time; |
4161 && (EMACS_SECS (before_time) - b->auto_save_failure_time < | 4161 && (EMACS_SECS (before_time) - b->auto_save_failure_time < |
4162 1200)) | 4162 1200)) |
4163 continue; | 4163 continue; |
4164 | 4164 |
4165 if (!preparing_for_armageddon && | 4165 if (!preparing_for_armageddon && |
4166 (XINT (b->saved_size) * 10 | 4166 (XFIXNUM (b->saved_size) * 10 |
4167 > (BUF_Z (b) - BUF_BEG (b)) * 13) | 4167 > (BUF_Z (b) - BUF_BEG (b)) * 13) |
4168 /* A short file is likely to change a large fraction; | 4168 /* A short file is likely to change a large fraction; |
4169 spare the user annoying messages. */ | 4169 spare the user annoying messages. */ |
4170 && XINT (b->saved_size) > 5000 | 4170 && XFIXNUM (b->saved_size) > 5000 |
4171 /* These messages are frequent and annoying for `*mail*'. */ | 4171 /* These messages are frequent and annoying for `*mail*'. */ |
4172 && !NILP (b->filename) | 4172 && !NILP (b->filename) |
4173 && NILP (no_message) | 4173 && NILP (no_message) |
4174 && disable_auto_save_when_buffer_shrinks) | 4174 && disable_auto_save_when_buffer_shrinks) |
4175 { | 4175 { |
4180 message | 4180 message |
4181 ("Buffer %s has shrunk a lot; auto save turned off there", | 4181 ("Buffer %s has shrunk a lot; auto save turned off there", |
4182 XSTRING_DATA (b->name)); | 4182 XSTRING_DATA (b->name)); |
4183 /* Turn off auto-saving until there's a real save, | 4183 /* Turn off auto-saving until there's a real save, |
4184 and prevent any more warnings. */ | 4184 and prevent any more warnings. */ |
4185 b->saved_size = make_int (-1); | 4185 b->saved_size = make_fixnum (-1); |
4186 if (!gc_in_progress) | 4186 if (!gc_in_progress) |
4187 Fsleep_for (make_int (1)); | 4187 Fsleep_for (make_fixnum (1)); |
4188 continue; | 4188 continue; |
4189 } | 4189 } |
4190 set_buffer_internal (b); | 4190 set_buffer_internal (b); |
4191 if (!auto_saved && NILP (no_message)) | 4191 if (!auto_saved && NILP (no_message)) |
4192 { | 4192 { |
4210 | 4210 |
4211 /* Arrange to close that file whether or not we get | 4211 /* Arrange to close that file whether or not we get |
4212 an error. */ | 4212 an error. */ |
4213 if (listdesc >= 0) | 4213 if (listdesc >= 0) |
4214 record_unwind_protect (do_auto_save_unwind, | 4214 record_unwind_protect (do_auto_save_unwind, |
4215 make_int (listdesc)); | 4215 make_fixnum (listdesc)); |
4216 } | 4216 } |
4217 | 4217 |
4218 /* Record all the buffers that we are auto-saving in | 4218 /* Record all the buffers that we are auto-saving in |
4219 the special file that lists them. For each of | 4219 the special file that lists them. For each of |
4220 these buffers, record visited name (if any) and | 4220 these buffers, record visited name (if any) and |
4272 /* Handler killed their own buffer! */ | 4272 /* Handler killed their own buffer! */ |
4273 if (!BUFFER_LIVE_P (b)) | 4273 if (!BUFFER_LIVE_P (b)) |
4274 continue; | 4274 continue; |
4275 | 4275 |
4276 b->auto_save_modified = BUF_MODIFF (b); | 4276 b->auto_save_modified = BUF_MODIFF (b); |
4277 b->saved_size = make_int (BUF_SIZE (b)); | 4277 b->saved_size = make_fixnum (BUF_SIZE (b)); |
4278 EMACS_GET_TIME (after_time); | 4278 EMACS_GET_TIME (after_time); |
4279 /* If auto-save took more than 60 seconds, | 4279 /* If auto-save took more than 60 seconds, |
4280 assume it was an NFS failure that got a timeout. */ | 4280 assume it was an NFS failure that got a timeout. */ |
4281 if (EMACS_SECS (after_time) - EMACS_SECS (before_time) > 60) | 4281 if (EMACS_SECS (after_time) - EMACS_SECS (before_time) > 60) |
4282 b->auto_save_failure_time = EMACS_SECS (after_time); | 4282 b->auto_save_failure_time = EMACS_SECS (after_time); |
4314 No auto-save file will be written until the buffer changes again. | 4314 No auto-save file will be written until the buffer changes again. |
4315 */ | 4315 */ |
4316 ()) | 4316 ()) |
4317 { | 4317 { |
4318 current_buffer->auto_save_modified = BUF_MODIFF (current_buffer); | 4318 current_buffer->auto_save_modified = BUF_MODIFF (current_buffer); |
4319 current_buffer->saved_size = make_int (BUF_SIZE (current_buffer)); | 4319 current_buffer->saved_size = make_fixnum (BUF_SIZE (current_buffer)); |
4320 current_buffer->auto_save_failure_time = -1; | 4320 current_buffer->auto_save_failure_time = -1; |
4321 return Qnil; | 4321 return Qnil; |
4322 } | 4322 } |
4323 | 4323 |
4324 DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure, 0, 0, 0, /* | 4324 DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure, 0, 0, 0, /* |