aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/fileio.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c96
1 files changed, 30 insertions, 66 deletions
diff --git a/src/fileio.c b/src/fileio.c
index af477792ec8..c81dc6705c7 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -246,9 +246,7 @@ static int e_write (int, Lisp_Object, int, int, struct coding_system *);
246 246
247 247
248void 248void
249report_file_error (string, data) 249report_file_error (const char *string, Lisp_Object data)
250 const char *string;
251 Lisp_Object data;
252{ 250{
253 Lisp_Object errstring; 251 Lisp_Object errstring;
254 int errorno = errno; 252 int errorno = errno;
@@ -286,8 +284,7 @@ report_file_error (string, data)
286} 284}
287 285
288Lisp_Object 286Lisp_Object
289close_file_unwind (fd) 287close_file_unwind (Lisp_Object fd)
290 Lisp_Object fd;
291{ 288{
292 emacs_close (XFASTINT (fd)); 289 emacs_close (XFASTINT (fd));
293 return Qnil; 290 return Qnil;
@@ -296,8 +293,7 @@ close_file_unwind (fd)
296/* Restore point, having saved it as a marker. */ 293/* Restore point, having saved it as a marker. */
297 294
298Lisp_Object 295Lisp_Object
299restore_point_unwind (location) 296restore_point_unwind (Lisp_Object location)
300 Lisp_Object location;
301{ 297{
302 Fgoto_char (location); 298 Fgoto_char (location);
303 Fset_marker (location, Qnil, Qnil); 299 Fset_marker (location, Qnil, Qnil);
@@ -539,8 +535,7 @@ get a current directory to run processes in. */)
539 535
540 536
541char * 537char *
542file_name_as_directory (out, in) 538file_name_as_directory (char *out, char *in)
543 char *out, *in;
544{ 539{
545 int size = strlen (in) - 1; 540 int size = strlen (in) - 1;
546 541
@@ -604,8 +599,7 @@ For a Unix-syntax file name, just appends a slash. */)
604 */ 599 */
605 600
606int 601int
607directory_file_name (src, dst) 602directory_file_name (char *src, char *dst)
608 char *src, *dst;
609{ 603{
610 long slen; 604 long slen;
611 605
@@ -688,9 +682,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p;
688 generated. */ 682 generated. */
689 683
690Lisp_Object 684Lisp_Object
691make_temp_name (prefix, base64_p) 685make_temp_name (Lisp_Object prefix, int base64_p)
692 Lisp_Object prefix;
693 int base64_p;
694{ 686{
695 Lisp_Object val; 687 Lisp_Object val;
696 int len, clen; 688 int len, clen;
@@ -1558,8 +1550,7 @@ See also the function `substitute-in-file-name'.")
1558 1550
1559/* If /~ or // appears, discard everything through first slash. */ 1551/* If /~ or // appears, discard everything through first slash. */
1560static int 1552static int
1561file_name_absolute_p (filename) 1553file_name_absolute_p (const unsigned char *filename)
1562 const unsigned char *filename;
1563{ 1554{
1564 return 1555 return
1565 (IS_DIRECTORY_SEP (*filename) || *filename == '~' 1556 (IS_DIRECTORY_SEP (*filename) || *filename == '~'
@@ -1571,8 +1562,7 @@ file_name_absolute_p (filename)
1571} 1562}
1572 1563
1573static unsigned char * 1564static unsigned char *
1574search_embedded_absfilename (nm, endp) 1565search_embedded_absfilename (unsigned char *nm, unsigned char *endp)
1575 unsigned char *nm, *endp;
1576{ 1566{
1577 unsigned char *p, *s; 1567 unsigned char *p, *s;
1578 1568
@@ -1823,8 +1813,7 @@ those `/' is discarded. */)
1823 (directory-file-name (expand-file-name FOO)). */ 1813 (directory-file-name (expand-file-name FOO)). */
1824 1814
1825Lisp_Object 1815Lisp_Object
1826expand_and_dir_to_file (filename, defdir) 1816expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
1827 Lisp_Object filename, defdir;
1828{ 1817{
1829 register Lisp_Object absname; 1818 register Lisp_Object absname;
1830 1819
@@ -1853,12 +1842,7 @@ expand_and_dir_to_file (filename, defdir)
1853 If QUICK is nonzero, we ask for y or n, not yes or no. */ 1842 If QUICK is nonzero, we ask for y or n, not yes or no. */
1854 1843
1855void 1844void
1856barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) 1845barf_or_query_if_file_exists (Lisp_Object absname, unsigned char *querystring, int interactive, struct stat *statptr, int quick)
1857 Lisp_Object absname;
1858 unsigned char *querystring;
1859 int interactive;
1860 struct stat *statptr;
1861 int quick;
1862{ 1846{
1863 register Lisp_Object tem, encoded_filename; 1847 register Lisp_Object tem, encoded_filename;
1864 struct stat statbuf; 1848 struct stat statbuf;
@@ -2228,8 +2212,7 @@ With a prefix argument, TRASH is nil. */)
2228} 2212}
2229 2213
2230static Lisp_Object 2214static Lisp_Object
2231internal_delete_file_1 (ignore) 2215internal_delete_file_1 (Lisp_Object ignore)
2232 Lisp_Object ignore;
2233{ 2216{
2234 return Qt; 2217 return Qt;
2235} 2218}
@@ -2495,8 +2478,7 @@ On Unix, this is a name starting with a `/' or a `~'. */)
2495/* Return nonzero if file FILENAME exists and can be executed. */ 2478/* Return nonzero if file FILENAME exists and can be executed. */
2496 2479
2497static int 2480static int
2498check_executable (filename) 2481check_executable (char *filename)
2499 char *filename;
2500{ 2482{
2501#ifdef DOS_NT 2483#ifdef DOS_NT
2502 int len = strlen (filename); 2484 int len = strlen (filename);
@@ -2520,8 +2502,7 @@ check_executable (filename)
2520/* Return nonzero if file FILENAME exists and can be written. */ 2502/* Return nonzero if file FILENAME exists and can be written. */
2521 2503
2522static int 2504static int
2523check_writable (filename) 2505check_writable (char *filename)
2524 char *filename;
2525{ 2506{
2526#ifdef MSDOS 2507#ifdef MSDOS
2527 struct stat st; 2508 struct stat st;
@@ -3235,8 +3216,7 @@ Lisp_Object Qfind_buffer_file_type;
3235 o set back the buffer multibyteness. */ 3216 o set back the buffer multibyteness. */
3236 3217
3237static Lisp_Object 3218static Lisp_Object
3238decide_coding_unwind (unwind_data) 3219decide_coding_unwind (Lisp_Object unwind_data)
3239 Lisp_Object unwind_data;
3240{ 3220{
3241 Lisp_Object multibyte, undo_list, buffer; 3221 Lisp_Object multibyte, undo_list, buffer;
3242 3222
@@ -3273,7 +3253,7 @@ static EMACS_INT non_regular_nbytes;
3273 Value is the number of bytes read. */ 3253 Value is the number of bytes read. */
3274 3254
3275static Lisp_Object 3255static Lisp_Object
3276read_non_regular () 3256read_non_regular (void)
3277{ 3257{
3278 EMACS_INT nbytes; 3258 EMACS_INT nbytes;
3279 3259
@@ -3291,7 +3271,7 @@ read_non_regular ()
3291 in insert-file-contents. */ 3271 in insert-file-contents. */
3292 3272
3293static Lisp_Object 3273static Lisp_Object
3294read_non_regular_quit () 3274read_non_regular_quit (void)
3295{ 3275{
3296 return Qnil; 3276 return Qnil;
3297} 3277}
@@ -4448,8 +4428,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4448static Lisp_Object build_annotations (Lisp_Object, Lisp_Object); 4428static Lisp_Object build_annotations (Lisp_Object, Lisp_Object);
4449 4429
4450static Lisp_Object 4430static Lisp_Object
4451build_annotations_unwind (arg) 4431build_annotations_unwind (Lisp_Object arg)
4452 Lisp_Object arg;
4453{ 4432{
4454 Vwrite_region_annotation_buffers = arg; 4433 Vwrite_region_annotation_buffers = arg;
4455 return Qnil; 4434 return Qnil;
@@ -4923,8 +4902,7 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
4923 as save-excursion would do. */ 4902 as save-excursion would do. */
4924 4903
4925static Lisp_Object 4904static Lisp_Object
4926build_annotations (start, end) 4905build_annotations (Lisp_Object start, Lisp_Object end)
4927 Lisp_Object start, end;
4928{ 4906{
4929 Lisp_Object annotations; 4907 Lisp_Object annotations;
4930 Lisp_Object p, res; 4908 Lisp_Object p, res;
@@ -5013,13 +4991,7 @@ build_annotations (start, end)
5013 The return value is negative in case of system call failure. */ 4991 The return value is negative in case of system call failure. */
5014 4992
5015static int 4993static int
5016a_write (desc, string, pos, nchars, annot, coding) 4994a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object *annot, struct coding_system *coding)
5017 int desc;
5018 Lisp_Object string;
5019 register int nchars;
5020 int pos;
5021 Lisp_Object *annot;
5022 struct coding_system *coding;
5023{ 4995{
5024 Lisp_Object tem; 4996 Lisp_Object tem;
5025 int nextpos; 4997 int nextpos;
@@ -5063,11 +5035,7 @@ a_write (desc, string, pos, nchars, annot, coding)
5063 are indexes to the string STRING. */ 5035 are indexes to the string STRING. */
5064 5036
5065static int 5037static int
5066e_write (desc, string, start, end, coding) 5038e_write (int desc, Lisp_Object string, int start, int end, struct coding_system *coding)
5067 int desc;
5068 Lisp_Object string;
5069 int start, end;
5070 struct coding_system *coding;
5071{ 5039{
5072 if (STRINGP (string)) 5040 if (STRINGP (string))
5073 { 5041 {
@@ -5259,8 +5227,7 @@ An argument specifies the modification time value to use
5259} 5227}
5260 5228
5261Lisp_Object 5229Lisp_Object
5262auto_save_error (error) 5230auto_save_error (Lisp_Object error)
5263 Lisp_Object error;
5264{ 5231{
5265 Lisp_Object args[3], msg; 5232 Lisp_Object args[3], msg;
5266 int i, nbytes; 5233 int i, nbytes;
@@ -5296,7 +5263,7 @@ auto_save_error (error)
5296} 5263}
5297 5264
5298Lisp_Object 5265Lisp_Object
5299auto_save_1 () 5266auto_save_1 (void)
5300{ 5267{
5301 struct stat st; 5268 struct stat st;
5302 Lisp_Object modes; 5269 Lisp_Object modes;
@@ -5322,8 +5289,8 @@ auto_save_1 ()
5322} 5289}
5323 5290
5324static Lisp_Object 5291static Lisp_Object
5325do_auto_save_unwind (arg) /* used as unwind-protect function */ 5292do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */
5326 Lisp_Object arg; 5293
5327{ 5294{
5328 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; 5295 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
5329 auto_saving = 0; 5296 auto_saving = 0;
@@ -5337,16 +5304,15 @@ do_auto_save_unwind (arg) /* used as unwind-protect function */
5337} 5304}
5338 5305
5339static Lisp_Object 5306static Lisp_Object
5340do_auto_save_unwind_1 (value) /* used as unwind-protect function */ 5307do_auto_save_unwind_1 (Lisp_Object value) /* used as unwind-protect function */
5341 Lisp_Object value; 5308
5342{ 5309{
5343 minibuffer_auto_raise = XINT (value); 5310 minibuffer_auto_raise = XINT (value);
5344 return Qnil; 5311 return Qnil;
5345} 5312}
5346 5313
5347static Lisp_Object 5314static Lisp_Object
5348do_auto_save_make_dir (dir) 5315do_auto_save_make_dir (Lisp_Object dir)
5349 Lisp_Object dir;
5350{ 5316{
5351 Lisp_Object mode; 5317 Lisp_Object mode;
5352 5318
@@ -5356,8 +5322,7 @@ do_auto_save_make_dir (dir)
5356} 5322}
5357 5323
5358static Lisp_Object 5324static Lisp_Object
5359do_auto_save_eh (ignore) 5325do_auto_save_eh (Lisp_Object ignore)
5360 Lisp_Object ignore;
5361{ 5326{
5362 return Qnil; 5327 return Qnil;
5363} 5328}
@@ -5627,8 +5592,7 @@ before any other event (mouse or keypress) is handled. */)
5627} 5592}
5628 5593
5629Lisp_Object 5594Lisp_Object
5630Fread_file_name (prompt, dir, default_filename, mustmatch, initial, predicate) 5595Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate)
5631 Lisp_Object prompt, dir, default_filename, mustmatch, initial, predicate;
5632{ 5596{
5633 struct gcpro gcpro1, gcpro2; 5597 struct gcpro gcpro1, gcpro2;
5634 Lisp_Object args[7]; 5598 Lisp_Object args[7];
@@ -5646,7 +5610,7 @@ Fread_file_name (prompt, dir, default_filename, mustmatch, initial, predicate)
5646 5610
5647 5611
5648void 5612void
5649syms_of_fileio () 5613syms_of_fileio (void)
5650{ 5614{
5651 Qoperations = intern_c_string ("operations"); 5615 Qoperations = intern_c_string ("operations");
5652 Qexpand_file_name = intern_c_string ("expand-file-name"); 5616 Qexpand_file_name = intern_c_string ("expand-file-name");