annotate src/sysfile.h @ 2367:ecf1ebac70d8

[xemacs-hg @ 2004-11-04 23:05:23 by ben] commit mega-patch configure.in: Turn off -Winline and -Wchar-subscripts. Use the right set of cflags when compiling modules. Rewrite ldap configuration to separate the inclusion of lber (needed in recent Cygwin) from the basic checks for the needed libraries. add a function for MAKE_JUNK_C; initially code was added to generate xemacs.def using this, but it will need to be rewritten. add an rm -f for junk.c to avoid weird Cygwin bug with cp -f onto an existing file. Sort list of auto-detected functions and eliminate unused checks for stpcpy, setlocale and getwd. Add autodetection of Cygwin scanf problems BETA: Rewrite section on configure to indicate what flags are important and what not. digest-doc.c, make-dump-id.c, profile.c, sorted-doc.c: Add proper decls for main(). make-msgfile.c: Document that this is old junk. Move proposal to text.c. make-msgfile.lex: Move proposal to text.c. make-mswin-unicode.pl: Convert error-generating code so that the entire message will be seen as a single unrecognized token. mule/mule-ccl.el: Update docs. lispref/mule.texi: Update CCL docs. ldap/eldap.c: Mule-ize. Use EXTERNAL_LIST_LOOP_2 instead of deleted EXTERNAL_LIST_LOOP. * XEmacs 21.5.18 "chestnut" is released. --------------------------------------------------------------- MULE-RELATED WORK: --------------------------------------------------------------- --------------------------- byte-char conversion --------------------------- buffer.c, buffer.h, insdel.c, text.c: Port FSF algorithm for byte-char conversion, replacing broken previous version. Track the char position of the gap. Add functions to do char-byte conversion downwards as well as upwards. Move comments about algorithm workings to internals manual. --------------------------- work on types --------------------------- alloc.c, console-x-impl.h, dump-data.c, dump-data.h, dumper.c, dialog-msw.c, dired-msw.c, doc.c, editfns.c, esd.c, event-gtk.h, event-msw.c, events.c, file-coding.c, file-coding.h, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-x.c, glyphs.c, glyphs.h, gui.c, hpplay.c, imgproc.c, intl-win32.c, lrecord.h, lstream.c, keymap.c, lisp.h, libsst.c, linuxplay.c, miscplay.c, miscplay.h, mule-coding.c, nas.c, nt.c, ntheap.c, ntplay.c, objects-msw.c, objects-tty.c, objects-x.c, print.c, process-nt.c, process.c, redisplay.h, select-common.h, select-gtk.c, select-x.c, sgiplay.c, sound.c, sound.h, sunplay.c, sysfile.h, sysdep.c, syswindows.h, text.c, unexnt.c, win32.c, xgccache.c: Further work on types. This creates a full set of types for all the basic semantics of `char' that I have so far identified, so that its semantics can always be identified for the purposes of proper Mule-safe code, and the raw use of `char' always avoided. (1) More type renaming, for consistency of naming. Char_ASCII -> Ascbyte UChar_ASCII -> UAscbyte Char_Binary -> CBinbyte UChar_Binary -> Binbyte SChar_Binary -> SBinbyte (2) Introduce Rawbyte, CRawbyte, Boolbyte, Chbyte, UChbyte, and Bitbyte and use them. (3) New types Itext, Wexttext and Textcount for separating out the concepts of bytes and textual units (different under UTF-16 and UTF-32, which are potential internal encodings). (4) qxestr*_c -> qxestr*_ascii. lisp.h: New; goes with other qxe() functions. #### Maybe goes in a different section. lisp.h: Group generic int-type defs together with EMACS_INT defs. lisp.h: * lisp.h (WEXTTEXT_IS_WIDE) New defns. lisp.h: New type to replace places where int occurs as a boolean. It's signed because occasionally people may want to use -1 as an error value, and because unsigned ints are viral -- see comments in the internals manual against using them. dynarr.c: int -> Bytecount. --------------------------- Mule-izing --------------------------- device-x.c: Partially Mule-ize. dumper.c, dumper.h: Mule-ize. Use Rawbyte. Use stderr_out not printf. Use wext_*(). sysdep.c, syswindows.h, text.c: New Wexttext API for manipulation of external text that may be Unicode (e.g. startup code under Windows). emacs.c: Mule-ize. Properly deal with argv in external encoding. Use wext_*() and Wexttext. Use Rawbyte. #if 0 some old junk on SCO that is unlikely to be correct. Rewrite allocation code in run-temacs. emacs.c, symsinit.h, win32.c: Rename win32 init function and call it even earlier, to initialize mswindows_9x_p even earlier, for use in startup code (XEUNICODE_P). process.c: Use _wenviron not environ under Windows, to get Unicode environment variables. event-Xt.c: Mule-ize drag-n-drop related stuff. dragdrop.c, dragdrop.h, frame-x.c: Mule-ize. text.h: Add some more stand-in defines for particular kinds of conversion; use in Mule-ization work in frame-x.c etc. --------------------------- Freshening --------------------------- intl-auto-encap-win32.c, intl-auto-encap-win32.h: Regenerate. --------------------------- Unicode-work --------------------------- intl-win32.c, syswindows.h: Factor out common options to MultiByteToWideChar and WideCharToMultiByte. Add convert_unicode_to_multibyte_malloc() and convert_unicode_to_multibyte_dynarr() and use. Add stuff for alloca() conversion of multibyte/unicode. alloc.c: Use dfc_external_data_len() in case of unicode coding system. alloc.c, mule-charset.c: Don't zero out and reinit charset Unicode tables. This fucks up dump-time loading. Anyway, either we load them at dump time or run time, never both. unicode.c: Dump the blank tables as well. --------------------------------------------------------------- DOCUMENTATION, MOSTLY MULE-RELATED: --------------------------------------------------------------- EmacsFrame.c, emodules.c, event-Xt.c, fileio.c, input-method-xlib.c, mule-wnnfns.c, redisplay-gtk.c, redisplay-tty.c, redisplay-x.c, regex.c, sysdep.c: Add comment about Mule work needed. text.h: Add more documentation describing why DFC routines were not written to return their value. Add some other DFC documentation. console-msw.c, console-msw.h: Add pointer to docs in win32.c. emacs.c: Add comments on sources of doc info. text.c, charset.h, unicode.c, intl-win32.c, intl-encap-win32.c, text.h, file-coding.c, mule-coding.c: Collect background comments and related to text matters and internationalization, and proposals for work to be done, in text.c or Internals manual, stuff related to specific textual API's in text.h, and stuff related to internal implementation of Unicode conversion in unicode.c. Put lots of pointers to the comments to make them easier to find. s/mingw32.h, s/win32-common.h, s/win32-native.h, s/windowsnt.h, win32.c: Add bunches of new documentation on the different kinds of builds and environments under Windows and how they work. Collect this info in win32.c. Add pointers to these docs in the relevant s/* files. emacs.c: Document places with long comments. Remove comment about exiting, move to internals manual, put in pointer. event-stream.c: Move docs about event queues and focus to internals manual, put in pointer. events.h: Move docs about event stream callbacks to internals manual, put in pointer. profile.c, redisplay.c, signal.c: Move documentation to the Internals manual. process-nt.c: Add pointer to comment in win32-native.el. lisp.h: Add comments about some comment conventions. lisp.h: Add comment about the second argument. device-msw.c, redisplay-msw.c: @@#### comments are out-of-date. --------------------------------------------------------------- PDUMP WORK (MOTIVATED BY UNICODE CHANGES) --------------------------------------------------------------- alloc.c, buffer.c, bytecode.c, console-impl.h, console.c, device.c, dumper.c, lrecord.h, elhash.c, emodules.h, events.c, extents.c, frame.c, glyphs.c, glyphs.h, mule-charset.c, mule-coding.c, objects.c, profile.c, rangetab.c, redisplay.c, specifier.c, specifier.h, window.c, lstream.c, file-coding.h, file-coding.c: PDUMP: Properly implement dump_add_root_block(), which never worked before, and is necessary for dumping Unicode tables. Pdump name changes for accuracy: XD_STRUCT_PTR -> XD_BLOCK_PTR. XD_STRUCT_ARRAY -> XD_BLOCK_ARRAY. XD_C_STRING -> XD_ASCII_STRING. *_structure_* -> *_block_*. lrecord.h: some comments added about dump_add_root_block() vs dump_add_root_block_ptr(). extents.c: remove incorrect comment about pdump problems with gap array. --------------------------------------------------------------- ALLOCATION --------------------------------------------------------------- abbrev.c, alloc.c, bytecode.c, casefiddle.c, device-msw.c, device-x.c, dired-msw.c, doc.c, doprnt.c, dragdrop.c, editfns.c, emodules.c, file-coding.c, fileio.c, filelock.c, fns.c, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-x.c, gui-msw.c, gui-x.c, imgproc.c, intl-win32.c, lread.c, menubar-gtk.c, menubar.c, nt.c, objects-msw.c, objects-x.c, print.c, process-nt.c, process-unix.c, process.c, realpath.c, redisplay.c, search.c, select-common.c, symbols.c, sysdep.c, syswindows.h, text.c, text.h, ui-byhand.c: New macros {alloca,xnew}_{itext,{i,ext,raw,bin,asc}bytes} for more convenient allocation of these commonly requested items. Modify functions to use alloca_ibytes, alloca_array, alloca_extbytes, xnew_ibytes, etc. also XREALLOC_ARRAY, xnew. alloc.c: Rewrite the allocation functions to factor out repeated code. Add assertions for freeing dumped data. lisp.h: Moved down and consolidated with other allocation stuff. lisp.h, dynarr.c: New functions for allocation that's very efficient when mostly in LIFO order. lisp.h, text.c, text.h: Factor out some stuff for general use by alloca()-conversion funs. text.h, lisp.h: Fill out convenience routines for allocating various kinds of bytes and put them in lisp.h. Use them in place of xmalloc(), ALLOCA(). text.h: Fill out the convenience functions so the _MALLOC() kinds match the alloca() kinds. --------------------------------------------------------------- ERROR-CHECKING --------------------------------------------------------------- text.h: Create ASSERT_ASCTEXT_ASCII() and ASSERT_ASCTEXT_ASCII_LEN() from similar Eistring checkers and change the Eistring checkers to use them instead. --------------------------------------------------------------- MACROS IN LISP.H --------------------------------------------------------------- lisp.h: Redo GCPRO declarations. Create a "base" set of functions that can be used to generate any kind of gcpro sets -- regular, ngcpro, nngcpro, private ones used in GC_EXTERNAL_LIST_LOOP_2. buffer.c, callint.c, chartab.c, console-msw.c, device-x.c, dialog-msw.c, dired.c, extents.c, ui-gtk.c, rangetab.c, nt.c, mule-coding.c, minibuf.c, menubar-msw.c, menubar.c, menubar-gtk.c, lread.c, lisp.h, gutter.c, glyphs.c, glyphs-widget.c, fns.c, fileio.c, file-coding.c, specifier.c: Eliminate EXTERNAL_LIST_LOOP, which does not check for circularities. Use EXTERNAL_LIST_LOOP_2 instead or EXTERNAL_LIST_LOOP_3 or EXTERNAL_PROPERTY_LIST_LOOP_3 or GC_EXTERNAL_LIST_LOOP_2 (new macro). Removed/redid comments on EXTERNAL_LIST_LOOP. --------------------------------------------------------------- SPACING FIXES --------------------------------------------------------------- callint.c, hftctl.c, number-gmp.c, process-unix.c: Spacing fixes. --------------------------------------------------------------- FIX FOR GEOMETRY PROBLEM IN FIRST FRAME --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. toolbar.c: bug fix for problem of initial frame being 77 chars wide on Windows. will be overridden by my other ws. --------------------------------------------------------------- FIX FOR LEAKING PROCESS HANDLES: --------------------------------------------------------------- process-nt.c: Fixes for leaking handles. Inspired by work done by Adrian Aichner <adrian@xemacs.org>. --------------------------------------------------------------- FIX FOR CYGWIN BUG (Unicode-related): --------------------------------------------------------------- unicode.c: Add workaround for newlib bug in sscanf() [should be fixed by release 1.5.12 of Cygwin]. --------------------------------------------------------------- WARNING FIXES: --------------------------------------------------------------- console-stream.c: `reinit' is unused. compiler.h, event-msw.c, frame-msw.c, intl-encap-win32.c, text.h: Add stuff to deal with ANSI-aliasing warnings I got. regex.c: Gather includes together to avoid warning. --------------------------------------------------------------- CHANGES TO INITIALIZATION ROUTINES: --------------------------------------------------------------- buffer.c, emacs.c, console.c, debug.c, device-x.c, device.c, dragdrop.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, events.c, extents.c, faces.c, file-coding.c, fileio.c, font-lock.c, frame-msw.c, glyphs-widget.c, glyphs.c, gui-x.c, insdel.c, lread.c, lstream.c, menubar-gtk.c, menubar-x.c, minibuf.c, mule-wnnfns.c, objects-msw.c, objects.c, print.c, scrollbar-x.c, search.c, select-x.c, text.c, undo.c, unicode.c, window.c, symsinit.h: Call reinit_*() functions directly from emacs.c, for clarity. Factor out some redundant init code. Move disallowed stuff that had crept into vars_of_glyphs() into complex_vars_of_glyphs(). Call init_eval_semi_early() from eval.c not in the middle of vars_of_() in emacs.c since there should be no order dependency in the latter calls. --------------------------------------------------------------- ARMAGEDDON: --------------------------------------------------------------- alloc.c, emacs.c, lisp.h, print.c: Rename inhibit_non_essential_printing_operations to inhibit_non_essential_conversion_operations. text.c: Assert on !inhibit_non_essential_conversion_operations. console-msw.c, print.c: Don't do conversion in SetConsoleTitle or FindWindow to avoid problems during armageddon. Put #errors for NON_ASCII_INTERNAL_FORMAT in places where problems would arise. --------------------------------------------------------------- CHANGES TO THE BUILD PROCEDURE: --------------------------------------------------------------- config.h.in, s/cxux.h, s/usg5-4-2.h, m/powerpc.h: Add comment about correct ordering of this file. Rearrange everything to follow this -- put all #undefs together and before the s&m files. Add undefs for HAVE_ALLOCA, C_ALLOCA, BROKEN_ALLOCA_IN_FUNCTION_CALLS, STACK_DIRECTION. Remove unused HAVE_STPCPY, HAVE_GETWD, HAVE_SETLOCALE. m/gec63.h: Deleted; totally broken, not used at all, not in FSF. m/7300.h, m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/apollo.h, m/att3b.h, m/aviion.h, m/celerity.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp300bsd.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/isi-ov.h, m/luna88k.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/news.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/orion105.h, m/pfa50.h, m/plexus.h, m/pmax.h, m/powerpc.h, m/pyrmips.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/symmetry.h, m/tad68k.h, m/tahoe.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/vax.h, m/wicat.h, m/xps100.h: Delete C_ALLOCA, HAVE_ALLOCA, STACK_DIRECTION, BROKEN_ALLOCA_IN_FUNCTION_CALLS. All of this is auto-detected. When in doubt, I followed recent FSF sources, which also have these things deleted.
author ben
date Thu, 04 Nov 2004 23:08:28 +0000
parents e5da225ea2ca
children ab71ad6ff3dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
777
e65d9cf16707 [xemacs-hg @ 2002-03-15 11:00:28 by ben]
ben
parents: 771
diff changeset
3 Copyright (C) 2000, 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not really in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
24 #ifndef INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
25 #define INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
26
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
27 /* The anonymous voice of the past says:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
28 Must come before sysfile.h
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
29
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
30 So instead we just put it here. --ben */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
31 #ifdef HAVE_LIBGEN_H
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
32 #include <libgen.h>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
33 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
34
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <errno.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
37 #ifndef WIN32_NATIVE
573
6cca1c9bdc85 [xemacs-hg @ 2001-05-25 03:49:08 by martinb]
martinb
parents: 558
diff changeset
38 # include <sys/errno.h> /* <errno.h> does not always imply this */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #ifdef HAVE_UNISTD_H
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
42 # include <unistd.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #ifndef INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 # define INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 # include <fcntl.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #endif /* INCLUDED_FCNTL */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
50 /* The anonymous voice of the past says:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 In some systems loading it twice is suicidal. */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
52 #ifndef INCLUDED_SYS_TYPES
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
53 # define INCLUDED_SYS_TYPES
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
54 # include <sys/types.h> /* some typedefs are used in sys/file.h */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
55 #endif /* INCLUDED_SYS_TYPES */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
56
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
57 #ifndef WIN32_NATIVE
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
58 # include <sys/file.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
59 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60
1467
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
61 /* Some systems (SCO 3.2v5) do #define stat ... in this header. So it
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
62 _must_ be included before any use of struct stat. Most emacs files
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
63 should include sysfile.h. The unex*.c include <sys/stat.h> directly. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 #include <sys/stat.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
65
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
66 #ifdef WIN32_ANY
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
67 # include <io.h>
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
68 #endif
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
69
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
70 #ifdef WIN32_NATIVE
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
71 # include <direct.h>
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
72 #else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
73 /* Some configuration files' definitions for the LOAD_AVE_CVT macro
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
74 (like sparc.h's) use macros like FSCALE, defined here. */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
75 # ifdef HAVE_GTK
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
76 /* I hate GTK */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
77 # undef MIN
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
78 # undef MAX
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
79 # endif /* HAVE_GTK */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
80 # include <sys/param.h>
609
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
81 /* As per Martin's recommendation, we do not include this. There was
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
82 a comment stating that stuff from here was needed on NeXT, Cygwin,
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
83 and sunplay.c. However, Cygwin includes this automatically from
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
84 fcntl.h, and Martin says that a "conforming" system should never
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
85 need this. We will put it back if necessary on systems requiring it. */
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
86 /* # include <sys/fcntl.h> */
777
e65d9cf16707 [xemacs-hg @ 2002-03-15 11:00:28 by ben]
ben
parents: 771
diff changeset
87 #endif /* WIN32_NATIVE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #ifndef STDERR_FILENO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #define STDIN_FILENO 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 #define STDOUT_FILENO 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 #define STDERR_FILENO 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 #ifndef O_RDONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 #define O_RDONLY 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 #ifndef O_WRONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #define O_WRONLY 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #ifndef O_RDWR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #define O_RDWR 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 /* file opening defaults */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #ifndef OPEN_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #define OPEN_BINARY O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #define OPEN_BINARY (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #ifndef OPEN_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #define OPEN_TEXT O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 #define OPEN_TEXT (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 #ifndef CREAT_MODE
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
125 #ifdef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 #define CREAT_MODE (S_IREAD | S_IWRITE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 #define CREAT_MODE (0666)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 #ifndef READ_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #define READ_TEXT "rt"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 #define READ_TEXT "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 #ifndef READ_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 #define READ_BINARY "rb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 #define READ_BINARY "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 #ifndef READ_PLUS_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
149 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 #define READ_PLUS_TEXT "r+t"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152 #define READ_PLUS_TEXT "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
154 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 #ifndef READ_PLUS_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
157 #ifdef O_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
158 #define READ_PLUS_BINARY "r+b"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
159 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
160 #define READ_PLUS_BINARY "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
161 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
162 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
163
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
164 #ifndef WRITE_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
165 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
166 #define WRITE_TEXT "wt"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
167 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
168 #define WRITE_TEXT "w"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
169 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
170 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
171
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 #ifndef WRITE_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 #define WRITE_BINARY "wb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 #define WRITE_BINARY "w"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
180 #ifndef APPEND_TEXT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
181 #ifdef O_TEXT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
182 #define APPEND_TEXT "at"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
183 #else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
184 #define APPEND_TEXT "a"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
185 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
186 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
187
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
188 #ifndef APPEND_BINARY
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
189 #ifdef O_BINARY
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
190 #define APPEND_BINARY "ab"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
191 #else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
192 #define APPEND_BINARY "a"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
193 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
194 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
195
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 #ifndef O_NONBLOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 #ifdef O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #define O_NONBLOCK O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 #define O_NONBLOCK 04000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 #if !S_IRUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 # if S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 # define S_IRUSR S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 # define S_IRUSR 00400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #if !S_IWUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 # if S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 # define S_IWUSR S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 # define S_IWUSR 00200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 #if !S_IXUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 # if S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 # define S_IXUSR S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 # define S_IXUSR 00100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 #ifdef STAT_MACROS_BROKEN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 #undef S_ISBLK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 #undef S_ISCHR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 #undef S_ISDIR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 #undef S_ISFIFO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 #undef S_ISLNK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 #undef S_ISMPB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 #undef S_ISMPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 #undef S_ISNWK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 #undef S_ISREG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 #undef S_ISSOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 #endif /* STAT_MACROS_BROKEN. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 #if !defined(S_ISBLK) && defined(S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 #if !defined(S_ISCHR) && defined(S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 #if !defined(S_ISDIR) && defined(S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 #if !defined(S_ISREG) && defined(S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 #if !defined(S_ISFIFO) && defined(S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 #if !defined(S_ISLNK) && defined(S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
270 /* Client .c files should simply use `PATH_MAX'. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271 #ifndef PATH_MAX
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
272 # if defined (_MAX_PATH)
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
273 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
274 # define PATH_MAX _MAX_PATH
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
275 # elif defined (_POSIX_PATH_MAX)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 # define PATH_MAX _POSIX_PATH_MAX
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 # elif defined (MAXPATHLEN)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
278 # define PATH_MAX MAXPATHLEN
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
279 # else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
280 # define PATH_MAX 1024
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
281 # endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
282 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
283
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
284 /* The following definitions are needed under Windows, at least */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
285 #ifndef X_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
286 # define X_OK 1
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
287 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
289 #ifndef R_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
290 # define R_OK 4
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
291 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
292
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
293 #ifndef D_OK
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
294 # define D_OK 8
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
295 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
296
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
297 #ifndef W_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
298 # define W_OK 2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
299 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
300
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
301 #ifndef F_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
302 # define F_OK 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 #ifndef FD_CLOEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 # define FD_CLOEXEC 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
309 #ifdef emacs
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
310
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 /* Emacs needs to use its own definitions of certain system calls on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 some systems (like SunOS 4.1 and USG systems, where the read system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 call is interruptible but Emacs expects it not to be; and under
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 MULE, where all filenames need to be converted to external format).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
316 We used to play preprocessor games, but in the long run that just leads
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
317 you to ruin. So we explicitly put in the new calls, even if the source
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
318 gets marginally less pretty.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
320 Current files where we don't use retry_ or qxe_ versions:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
322 -- all sound files except ntplay.c (includes esd.c libsst.[ch] libst.h
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
323 linuxplay.c sgiplay.c sunplay.c
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
324 hpplay.c nas.c)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
325 -- all unex* files
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
326 -- hftctl.c
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
327 -- lib-src files
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
328 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
330 ssize_t retry_read (int, void *, size_t);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
331 ssize_t retry_write (int, const void *, size_t);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
332 int retry_open (const Extbyte *path, int oflag, ...);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
333 int qxe_open (const Ibyte *path, int oflag, ...);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
334 int qxe_interruptible_open (const Ibyte *path, int oflag, int mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
335 int retry_close (int);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
336 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
337 Bytecount write_allowing_quit (int fildes, const void *buf,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
338 Bytecount size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 /* Now the stdio versions ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
342 size_t retry_fread (void *, size_t, size_t, FILE *);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
343 size_t retry_fwrite (const void *, size_t, size_t, FILE *);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1467
diff changeset
344 FILE *retry_fopen (const Extbyte *path, const Ascbyte *mode);
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 1467
diff changeset
345 FILE *qxe_fopen (const Ibyte *path, const Ascbyte *mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
346 int retry_fclose (FILE *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 /* encapsulations: file-information calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
350 int qxe_access (const Ibyte *path, int mode);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
351 int qxe_eaccess (const Ibyte *path, int mode);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
352 int qxe_lstat (const Ibyte *path, struct stat *buf);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
353 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
354 int qxe_fstat (int fd, struct stat *buf);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
355 int qxe_stat (const Ibyte *path, struct stat *buf);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
356 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path []);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 /* encapsulations: file-manipulation calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
360 int qxe_chmod (const Ibyte *path, mode_t mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
361
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
362 #if defined (HAVE_LINK)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
363 int qxe_link (const Ibyte *existing, const Ibyte *new);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
364 #endif /* defined (HAVE_LINK) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
365
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
366 int qxe_rename (const Ibyte *old, const Ibyte *new);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
367
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
368 #if defined (HAVE_SYMLINK)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
369 int qxe_symlink (const Ibyte *name1, const Ibyte *name2);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
370 #endif /* defined (HAVE_SYMLINK) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
371
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
372 int qxe_unlink (const Ibyte *path);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
373
1467
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
374 /* definition in filemode.c
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
375 must be declared here to ensure that struct stat is properly formed
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
376 on systems like SCO 3.2v5 */
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
377 void filemodestring (struct stat *, char *);
e5da225ea2ca [xemacs-hg @ 2003-05-09 09:50:40 by stephent]
stephent
parents: 1315
diff changeset
378
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
379 #endif /* emacs */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
380
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
381
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
382 #ifndef HAVE_H_ERRNO
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
383 extern int h_errno;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
386 #ifndef HAVE_DUP2
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
387 int dup2 (int oldd, int newd);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
390 #ifndef HAVE_STRERROR
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
391 /* X11R6 defines strerror as a macro */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
392 # ifdef strerror
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
393 # undef strerror
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
394 # endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
395 const char *strerror (int);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
398
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
399
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
400 /*
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
401 DEFAULT_DIRECTORY_SEP is the default value of Vdirectory_sep_char.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
402 DIRECTORY_SEP is the currently preferred separator between elements
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
403 of a path, when paths are canonicalized.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
404 DEVICE_SEP is the separator between devices and paths (might not
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
405 be defined).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
406 SEPCHAR is the separator between paths in a path search string
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
407 (e.g. the PATH environment variable).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
408 IS_DIRECTORY_SEP() returns true if the character is any directory
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
409 separator (there might be more than one allowed on a system.).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
410 IS_DEVICE_SEP() returns true if the character is a device separator.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
411 IS_ANY_SEP() returns true if the character is a directory or device
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
412 separator.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
413 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
414
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
415 #ifdef emacs
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
417 /* We used to put some of this stuff in the s+m files for the various
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
418 types of MS Windows, but that's disingenuous. The various definitions
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
419 above were specifically created for MS Windows, and the "if not, then
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
420 let's define the defaults" stuff (formerly in lisp.h) specifically knows
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
421 about what is going to get redefined and how, and code all over the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
422 place that works with filenames has to conditionalize on WIN32_NATIVE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
423 anyway. It's much clearer if we put all related definitions in one
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
424 place. (In fact, I discovered a number of bugs in the process.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
425
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
426 S+M files should be used for simple on-off or multiple-choice settings,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
427 or possibly string settings. Anything that gets to the level of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
428 programming should be elsewhere, and anything that ends up having
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
429 lots of complicated interactions scattered around in many files should
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
430 be consolidated. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
431
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
432 #ifdef WIN32_NATIVE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
433
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
434 #define SEPCHAR ';'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
435 #define DEFAULT_DIRECTORY_SEP '\\'
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
437 DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
438 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
439 if (!CHARP (Vdirectory_sep_char)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
440 || (XCHAR (Vdirectory_sep_char) != '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
441 && XCHAR (Vdirectory_sep_char) != '\\'))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
442 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
443 warn_when_safe
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
444 (Qfile_name, Qerror,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
445 "`directory-sep-char' set to invalid %s: resetting to %c.",
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
446 DEFAULT_DIRECTORY_SEP);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
447 Vdirectory_sep_char = make_char (DEFAULT_DIRECTORY_SEP);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
448 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
449
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
450 return XCHAR (Vdirectory_sep_char);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
451 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
452 #define DIRECTORY_SEP sysfile_get_directory_sep()
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
453
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
454 #else /* not WIN32_NATIVE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
455
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
456 #define SEPCHAR ':'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
457 #define DEFAULT_DIRECTORY_SEP '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
458 #define DIRECTORY_SEP '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
459
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
460 #endif /* WIN32_NATIVE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
461
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
463 #ifdef WIN32_ANY
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
464
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
465 #define DEVICE_SEP ':'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
466
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
467 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
468
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
469 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
470 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
471 return (c == '/' || c == '\\');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
472 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
473
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
474 DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
475 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
476 return (c == '/' || c == '\\' || c == ':');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
477 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
478
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
479 #else /* not WIN32_ANY */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
480
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
481 #define IS_DEVICE_SEP(c) 0
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
482 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
483 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
484
1315
70921960b980 [xemacs-hg @ 2003-02-20 08:19:28 by ben]
ben
parents: 867
diff changeset
485 #endif /* WIN32_ANY */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
486
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
487 #endif /* emacs */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
488
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
489 #endif /* INCLUDED_sysfile_h_ */