ftp.nice.ch/pub/next/unix/mail/zend.1.0.s.tar.gz#/zend-1.0/include/portdefs.h

This is portdefs.h in view mode; [Download] [Up]

/*+++*
 *  RCS		$Id: portdefs.h,v 1.13 1993/02/02 21:00:42 gerben Exp $
 *  title:	portdefs.h
 *  abstract:	Improve portability of C software.
 *  author:	T.R.Hageman, Groningen, The Netherlands
 *  created:	September 1992 (reimplementation of existing sources)
 *  modified:	(see RCS Log at end)
 *  copyleft:
 *
 *		Copyright (C) 1992  Tom R. Hageman.
 *
 *	This is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This software is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this software; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  description:
 *
 *	Resolve some common compiler-dependent issues.
 *
 *	Overview:
 *
 *	(items marked with `@' can be overridden from the command line,
 *	 or from "config.h" by the mechanism below)
 *
 *	- read configuration file "config.h" (possibly generated by an
 *	  auto-configure script) if _PORT_CONFIG is defined.
 *
 *	- setup compiler-independent flags for some known system types:
 *	    __MSDOS__
 *	    __MINIX__	(also sets __UNIX__)
 *	    __TOS__
 *	    __UNIX__	(also sets `unix' if not __STRICT_ANSI__)
 *	    __VMS__
 *	    __XENIX__	(also sets __UNIX__)
 *	  @ __POSIX__	(in principle, independent of other types.)
 *	  @ __SYSV__
 *	  @ __BSD__
 *
 *	- setup @ __MSHORT__ iff (sizeof(int) == sizeof(short)),
 *
 *	- determine ANSI-ness of the compiler (see "portansi.h"),
 *
 *	- determine various other compiler aspects:
 *	  @ _HAS_UNSIGNED_	(1) if compiler knows unsigned {char,long},
 *	  @ _HAS_VOID_		(-1) if compiler knows `void' only;
 *				(1) if compiler knows both `void' and `void *',
 *	  @ __CHAR_UNSIGNED__	if default `char' type is unsigned,
 *
 *	- explicit character sign-(non)extension macros:
 *	  @ _UC_(c)		extend `c' as if it were an (unsigned char),
 *	  @ _SC_(c)		extend `c' as if it were a (signed char),
 *
 *	- @ _I_<header>
 *
 *	  define _I_<header> flags for all headers mandated by Posix
 *	  but not by ANSI that are known to exist:
 *
 *		 <dirent.h>	 <fcntl.h>	[<grp.h>]	[<pwd.h>]
 *		[<sys/stat.h>]	[<sys/times.h>]	[<sys/types.h>]	 <sys/utsname.h>
 *		 <sys/wait.h>	 <tar.h>	 <termios.h>	 <unistd.h>
 *		 <utime.h>
 *
 *	  The headers in [ ] are present on the majority of UNIX systems,
 *	  so these are assumed PRESENT unless the corresponding _I_<header>
 *	  is defined as (-1).  The other headers are assumed ABSENT unless
 *	  the corresponding _I_<header> is defined as 1.
 *	  (Note: <header> stands for the name of the header in all CAPS
 *	   without the trailing ".h" and any `/' replaced with `_')
 *
 *	  Other _I_<header> flags may be defined if the related Posix
 *	  headers are not available:
 *
 *		[<sys/types.h>]	->  <types.h>
 *		[<sys/stat.h>]	->  <stat.h>
 *		 <termios.h>	->  <termio.h>	-> [<sgtty.h>]
 *
 *	- define various datatypes mandated by ANSI C and/or Posix:
 *	  @ ptrdiff_t		(ANSI) integer type big enough to hold any
 *				pointer difference (not if __STRICT_POSIX__),
 *	  @ size_t		(ANSI/Posix) type returned by `sizeof' operator,
 *	  @ ssize_t		(Posix) signed version of `size_t',
 *
 *	- real-life portability kludges:
 *	  @ _LIBC_NEEDS_PROMOTION	if library is built by an oldstyle
 *				compiler and used by an ANSI compiler; in this
 *				case the library functions should be prototyped
 *				with promoted parameter types instead of the
 *				actual types if these are subject to default
 *				promotion.
 *
 *	  @ _P_<function>_RETURN_TYPE	to accommodate standard library
 *				functions that have, for historic reasons,
 *				different return types than prescribed by
 *				ANSI C.  (These are ignored if _ANSI_LIBRARY_)
 *
 *	  @ _P_TRADITIONAL_RETURN_TYPES	request traditional return types for
 *				abort, exit, free, qsort, srand (int) and
 *				bsearch, mem*, {m,c,re}alloc, sprintf (char *).
 *
 *	- optional portability modes, which are provided only if explicitly
 *	  requested (to issue a request, #define the corresponding macro
 *	  before including this header):
 *
 *	    _PORT_TYPES		various general datatypes, one or more of:
 *		_PORT_BWL_TYPES		BYTE-WORD-LONG style (default),
 *		_PORT_INTN_TYPES	INT[124] style,
 *
 *	    _PORT_CONSTS	various more-or-less useful constants:
 *				(NIL, NUL, EOF, TRUE, FALSE, OK, ERR)
 *
 *	    _PORT_FUNCTIONS	various function aliases, one or more of:
 *		_PORT_CHR_FUNCTIONS	str[r]chr <-> [r]index (default),
 *		_PORT_MEM_FUNCTIONS	mem{cpy,cmp} <-> b{copy,cmp}, bzero
 *
 *	    _PORT_STYLE		various style aliases, optionally:
 *		_PORT_REG_STYLE		(REG, REGL)
 *
 *	    _PORT_KEYWORDS	keyword compatibility modes for some compilers:
 *		_PORT_GNUC_KEYWORDS	various Gnu C extension keywords,
 *		_PORT_DOS_KEYWORDS	DOS-keyword portability mode,
 *		_PORT_TOS_KEYWORDS	TOS-keyword portability mode,
 *
 *	    _PORT_FILENAME	various filename-related macros,
 *
 *	    _PORT_ERROR		declaration of error(), puterr() functions.
 *
 *	This file is designed to work together well with a "config.h" generated
 *	by GNU Autoconfig or Larry Wall's Metaconfig.  In the absence of such
 *	a configuration file, reasonable (I hope) assumptions are made about
 *	some (hopefully most) systems I happen to be acquainted with.
 *
 *	These are:
 *
 *	  Unix		- NeXT 2.1/3.0, pdp-11 7th Ed, Atari ST Minix 1.5,
 *			  SunOS 4.1, SCO unix 3.2.2
 *			  (HP-UX 5.5, SCO, Xenix, Ultrix, ibm rt AIX
 *			   untested)
 *
 *	  MSDOS		- Microsof C 5.1 and up, Turbo/Borland C 3.0.
 *
 *	  Atari TOS	- Gnu C 1.37 (jrb distribution),
 *			  Turbo C 2.03 (with my own UNIX library enhancements)
 *
 *	  VMS		- Vax C 3.2 on VMS 5.x
 *
 *	This file is also supposed to be compatible with Posix.1 and ANSI
 *	standards.  Related flags are:
 *
 *	@ __STRICT_ANSI__	- enforce strict ANSI C conformance.
 *
 *	@ __STRICT_POSIX__	- enforce strict Posix.1 conformance.
 *
 *	(Note that the Posix standard states that strict conformance is
 *	 forced by definition the ``feature test'' macro _POSIX_SOURCE, but
 *	 in this less-than-perfect world some compilers seem to use that
 *	 just to enable their (otherwise invisible) Posix features...
 *	 hence this separate macro)
 *---*/

/* Configuration section.  (protected against multiple inclusion.) */

#ifndef _PORTDEFS_H_
#define _PORTDEFS_H_	0x112

/* Include local configuration, if so requested.
   (probably generated by an auto-configure script) */

#ifdef _PORT_CONFIG
#   include "config.h"
#endif

#if 0
/*
 * _defined_empty_(macroname)
 *
 *	This utility macro tests whether macroname's definition is empty.
 *	It should be used ONLY in a preprocessor conditional statement.
 *	(The definition below works since (2*macro-1) evaluates to an odd
 *	 number for all numeric replacement values of `macro', and to (-2),
 *	 i.e., an even number, if `macro' expands to a blank string.
 *	 This trick relies on undefined or non-numeric macros being
 *	 evaluated to 0 (the number zero).)
 *	{{Unfortunately this is useless since olden preprocessors do not
 *	  expand macros with arguments in preprocessor #if expressions,
 *	  so we are forced to use the literal expression.  Sigh.}}
 *
 * _empty_or_nonzero_(macroname)
 *
 *	Analogous to the above, tests whether macroname's definition is
 *	empty or non-zero.  Evaluates FALSE if macro is undefined.
 *	{{In practice we use the literal expression, as explained above,
 *	  and we ditch the 2*0 from it to avoid clutter.}}
 *
 * _undef_or_zero_(macroname)
 *
 *	The logical negation of _empty_or_nonzero_(macroname).
 */
#   define _defined_empty_(macroname)		(2*macroname-1==2*-1)
#   define _empty_or_nonzero_(macroname)	(2*macroname-1!=2*0-1)
#   define _undef_or_zero_(macroname)		(2*macroname-1==2*0-1)
#endif

/* Some systems that I happen to know about. */

#ifdef TOS			/* Lattice C (Atari ST) */
#   define __TOS__	1
#endif
#ifdef MSDOS			/* Microsof C */
#   define __MSDOS__	1
#   ifndef __TURBOC__
#	ifndef __MSC__
#	    define __MSC__	1
#	endif
#   endif
#endif
#ifdef _MINIX			/* Minix?? */
#   define __MINIX__	1
#endif
#if (2* M_XENIX -1!=-1)		/* SCO Xenix */
#   define __XENIX__	1
#endif
#if (unix || __unix__ || __UNIX__ || __XENIX__ || __MINIX__) /* Unix clones. */
#   ifndef __UNIX__
#	define __UNIX__	1
#   endif
#   ifndef unix
#	ifndef __STRICT_ANSI__
#	    ifndef __STRICT_POSIX__
#		define unix	1
#	    endif
#	endif
#   endif
#endif
#if (vms || __vms__ || __VMS__)
#   ifndef __VMS__
#	define __VMS__	1
#   endif
#   ifndef vms
#	ifndef __STRICT_ANSI__
#	    ifndef __STRICT_POSIX__
#		define vms	1
#	    endif
#	endif
#   endif
#endif

/*
 * __SYSV__	Generic AT&T System V Unix.
 *
 *   Assumes the existence of the following headers:
 *	<fcntl.h>
 *	<string.h>
 *	<termio.h> (if not also Posix-compliant)
 *	<utime.h>
 *
 *   Also assumes the existence of the following functions/variables:
 *	tzset(), tzname[2], timezone	in <time.h>.
 */
#ifndef __SYSV__
#   if (2* SVR2 -1!=-1		|| \
	2* SVR3 -1!=-1		|| \
	2* SVR4 -1!=-1		|| \
	hpux || __hpux__	|| \
	sco || __sco__		|| \
	/* Add other known SYSV systems here. */0)
#	define __SYSV__	1
#   endif
#else
#   if (2*__SYSV__-1==2*-1)
#	undef __SYSV__
#	define __SYSV__	1
#   endif
#endif

/*
 * __BSD__	Generic Berkeley Standard Distribution Unix.
 *
 *   Assumes the existence of the following headers:
 *	<strings.h>	(if not also ANSI- or Posix compliant)
 *	<sgtty.h>	(if not also Posix-compliant)
 *	<sys/wait.h>	(with union wait, if not Posix-compliant)
 *
 *   Also assumes the existence of the following functions/variables:
 */
#ifndef __BSD__
#   if (2* BSD -1!=-1		|| \
	NeXT || __NeXT__	|| \
	sun || __sun__		|| \
	/* Add other known BSD systems here. */0)
#	define __BSD__	1
#   endif
#else
#   if (2*__BSD__-1==2*-1)
#	undef __BSD__
#	define __BSD__	1
#   endif
#endif


/* Determine size of int, if we can. ("portansi.h" occasionally needs it!) */

#ifndef __MSHORT__
#   if __TURBOC__
	/* Turbo C allows the use of `sizeof' in preprocessor conditionals. */
#	if (sizeof(int) == sizeof(short))	/* {{MS-DOS too?}} */
#	    define __MSHORT__	1
#	endif
#   endif
#   ifdef MSDOS			/* Microsof C (6.1 and down at least) */
#	define __MSHORT__	1
#   endif
#   if pdp11
#	define __MSHORT__	1
#   endif
#else
#   if (2*__MSHORT__-1==2*-1)		/* Empty definition, assume TRUE. */
#	undef __MSHORT__
#	define __MSHORT__	1
#   endif
#endif


/* Resolve ANSI-ness of compilation environment. */

#ifndef _ANSI_HEADERS_
#   ifdef STDC_HEADERS			/* Autoconfig. */
#	if (2*STDC_HEADERS-1==2*0-1)
#	    define _ANSI_HEADERS_	0
#	else
#	    define _ANSI_HEADERS_	1
#	endif
#   else
#	if (sco || __sco__	/* 3.2.2(?) */	|| \
	    ultrix || __ultrix__	/* Ultrix ?.? */|| \
	    /* Add other trusted systems here. */0)
#	    define _ANSI_HEADERS_	1
#	endif
#   endif
#endif


/* Resolve ANSI-ness of the compiler. */

#ifndef _PORTANSI_H_
#   include "portansi.h"
#endif



/* Determine size of int, if we can. ("portansi.h" occasionally needs it!) */

#ifndef __MSHORT__
#   if __TURBOC__
	/* Turbo C allows the use of `sizeof' in preprocessor conditionals. */
#	if (sizeof(int) == sizeof(short))	/* {{MS-DOS too?}} */
#	    define __MSHORT__	1
#	endif
#   endif
#   ifdef MSDOS			/* Microsof C (6.1 and down at least) */
#	define __MSHORT__	1
#   endif
#   if pdp11
#	define __MSHORT__	1
#   endif
#else
#   if (2*__MSHORT__-1==2*-1)		/* Empty definition, assume TRUE. */
#	undef __MSHORT__
#	define __MSHORT__	1
#   endif
#endif


/* Resolve ANSI-ness of compilation environment. */

#ifndef _ANSI_HEADERS_
#   ifdef STDC_HEADERS			/* Autoconfig. */
#	if (2*STDC_HEADERS-1==2*0-1)
#	    define _ANSI_HEADERS_	0
#	else
#	    define _ANSI_HEADERS_	1
#	endif
#   else
#	if (sco || __sco__	/* 3.2.2(?) */	|| \
	    ultrix || __ultrix__	/* Ultrix ?.? */|| \
	    /* Add other trusted systems here. */0)
#	    define _ANSI_HEADERS_	1
#	endif
#   endif
#endif


/* Resolve ANSI-ness of the compiler. */

#ifndef _PORTANSI_H_
#   include "portansi.h"
#endif


/* {{WARNING: There isn't a truly satisfactory way to check for Posix
     systems yet.  For now, this requires you to define either __POSIX__
     or _I_UNISTD/I_UNISTD/HAVE_UNISTD_H to the right value, and issue the
     _POSIX_SOURCE request only if you are compiling on a Posix system}} */

/* (Moved beyond "portansi.h" to let <unistd.h> see the right `void'.) */
/* (Moved beyond "portansi.h" to let <unistd.h> see the right `void'.) */
#ifndef __POSIX__
#   ifdef _POSIX_SOURCE
#	define __POSIX__	1
#   endif
#   ifdef POSIX				/* Larry Wall's Metaconfig. */
#	define __POSIX__	1
#   endif
#else
#   if (2*__POSIX__-1==2*-1)		/* Empty definition, assume TRUE. */
#	undef __POSIX__
#	define __POSIX__	1
#   endif
#endif

#ifndef _I_UNISTD
#   if (2* HAVE_UNISTD_H -1!=-1	/* GNU's Autoconfig. */ || \
	2* I_UNISTD -1!=-1	/* Metaconfig. */	|| \
	__POSIX__ /* When claimed to be Posix, check that it indeed is. */ || \
	__MINIX__		/* 1.5 */		|| \
	sun || __sun__		/* 4.1 */		|| \
	sco || __sco__		/* 3.2.2(?) */		|| \
	ultrix || __ultrix__	/* Ultrix ?.? */	|| \
	/* Add other trusted systems here. */0)
#	define _I_UNISTD	1
#   endif
#else
#   if (2*_I_UNISTD-1==2*-1)
#	undef _I_UNISTD
#	define _I_UNISTD	1
#   endif
#endif

#if _I_UNISTD
#   ifndef _SYS_TYPES_H_	/* <unistd.h> needs types from <sys/types.h> */
#	include <sys/types.h>
#	define _SYS_TYPES_H_
#   endif
#   include <unistd.h>

#   ifdef _POSIX_VERSION	/* Only defined in <unistd.h> if Posix. */
#	ifndef __POSIX__
#	    define __POSIX__	1
#	endif
#   else
#	undef __POSIX__
#	undef _POSIX_SOURCE	/* {{this is debatable.}} */
#   endif
#endif


#if pdp11			/* Ancient K&R compiler */
#   define _KNR_ANTIQUE_	1
#endif


/* Determine existence of other system header files (if we can). */


/* Does compiler know unsigned {char,long}? */

#ifndef _HAS_UNSIGNED_
#   if (_ANSI_C_ || !_KNR_ANTIQUE_)
#	define _HAS_UNSIGNED_	1
#   endif
#else
#   if (2*_HAS_UNSIGNED_-1==2*-1)	/* Empty definition, assume TRUE. */
#	undef _HAS_UNSIGNED_
#	define _HAS_UNSIGNED_	1
#   endif
#endif


/* Does compiler know both `void' and `void *'? */

#ifndef _HAS_VOID_
#   if _ANSI_void_			/* knows both `void' and `void *' */
#	define _HAS_VOID_	1
#   else
#	if !_KNR_ANTIQUE_		/* knows `void' only */
#	    define _HAS_VOID_	-1
#	endif
#   endif
#else
#   if (2*_HAS_VOID_-1==2*-1)		/* Empty definition, assume TRUE. */
#	undef _HAS_VOID_
#	define _HAS_VOID_	1
#   endif
#endif


/* Determine signedness of `char'. */

#ifndef __CHAR_UNSIGNED__
#   ifndef __CHAR_SIGNED__
#	if ('\377' > 0)	/* {{assume the preprocessor handles character
			     constants the same way the compiler does.}} */
#	    define __CHAR_UNSIGNED__	1
#	endif
#   endif
#else
#   ifdef __CHAR_SIGNED__
	#error "__CHAR_UNSIGNED__ and __CHAR_SIGNED__ conflict."
#   endif
#   if (2*__CHAR_UNSIGNED__-1==2*-1)	/* Empty definition, assume TRUE. */
#	undef __CHAR_UNSIGNED__
#	define __CHAR_UNSIGNED__	1
#   endif
#endif


/* Explicit conversion to unsigned char. */

#ifndef _UC_
#   if _HAS_UNSIGNED_
#	define _UC_(c)		((unsigned char)(c))
#   else
#	if __CHAR_UNSIGNED__
#	    define _UC_(c)	((char)(c))
#	else
	    /* {{WARNING: assumes 8-bit char.}} */
#	    define _UC_(c)	((c)&0xFF)
#	endif
#   endif
#endif


/* Explicit conversion to signed char. */

#ifndef _SC_
#   if (_ANSI_signed_ || !__CHAR_UNSIGNED__)
#	define _SC_(c)		((signed char)(c))
#   else
	/* {{WARNING: assumes 8-bit char and 2's complement arithmetic.}} */
#	define _SC_(c)		(((c)^0x80)-0x80)
#   endif
#endif

/* {{The previous definitions rely heavily on the compiler doing the right
     things with implicit and explicit integer conversions.  Unfortunately
     some compilers cannot be trusted in this respect...}} */


/* Flags to indicate that the corresponding header files exist. */

#if __POSIX__

#   ifndef _ANSI_HEADERS_	/* Posix implies existence of ANSI headers. */
#	define _ANSI_HEADERS_	1
#	ifndef _I_FLOAT		/* ...except <float.h> */
#	    define _I_FLOAT	-1
#	endif
#   endif
#   define _I_DIRENT	1
#   define _I_FCNTL	1
/*# define _I_GRP	1	implied */
/*# define _I_PWD	1	implied */
/*# define _I_SYS_STAT	1	implied */
/*# define _I_SYS_TIMES	1	implied */
/*# define _I_SYS_TYPES	1	implied */
#   define _I_SYS_UTSNAME	1
#   define _I_SYS_WAIT	1
#   define _I_TAR	1
# if !(__MINIX__)		/* Minix 1.5 <termios.h> not yet implemented. */
#   define _I_TERMIOS	1
# endif
#   define _I_UTIME	1

#else /* !__POSIX__ */

#   ifndef _I_DIRENT
#	if (2* DIRENT -1!=-1		/* Autoconfig. */	|| \
	    2* HAVE_DIRENT_H -1!=-1	/* Alt. Autoconfig. */	|| \
	    2* I_DIRENT -1!=-1		/* Metaconfig. */	|| \
	    /* Add other systems known to have it here. */0)
#	    define _I_DIRENT	1
#	endif
#   endif
#   if !_I_DIRENT
#	ifndef _I_NDIR
#	    if (2* HAVE_NDIR_H -1!=-1	/* Autoconfig. */	|| \
		2* I_NDIR -1!=-1	/* Metaconfig. */	|| \
		/* Add other systems known to have it here. */0)
#		define _I_NDIR	1
#	    endif
#	endif
#	if !_I_NDIR
#	    ifndef _I_SYS_NDIR
#		if (2* SYSNDIR -1!=-1		/* Autoconfig. */	|| \
		    2* HAVE_SYS_NDIR_H -1!=-1	/* Alt. Autoconfig. */	|| \
		    2* I_SYS_NDIR -1!=-1	/* Metaconfig. */	|| \
		    /* Add other systems known to have it here. */0)
#		    define _I_SYS_NDIR	1
#		endif
#	    endif
#	    if !_I_SYS_NDIR
#		ifndef _I_SYS_DIR
#		    if (2* HAVE_SYS_DIR_H -1!=-1/* Autoconfig. */	|| \
			2* I_SYS_DIR -1!=-1	/* Metaconfig. */	|| \
			__BSD__	|| \
			/* Add other systems known to have it here. */0)
#			define _I_SYS_DIR	1
#		    endif
#		endif
#	    endif
#	endif
#   endif

#   ifndef _I_FCNTL
#	if (2* HAVE_FCNTL_H -1!=-1	/* Autoconfig. */	|| \
	    2* I_FCNTL -1!=-1		/* Metaconfig. */	|| \
	    __MINIX__ || \
	    __XENIX__ || \
	    __SYSV__ || \
	    __MSDOS__ && (__TURBOC__ || __MSC__) || \
	    __TOS__ && __GNUC__ || \
	    /* Add other systems known to have it here. */0)
#	    define _I_FCNTL	1
#	endif
#   endif

#   ifndef _I_GRP
#	ifdef HAVE_GRP_H		/* Autoconfig. */
#	    if (2* HAVE_GRP_H -1==-1)
#		define _I_GRP	-1
#	    endif
#	else
#	    ifndef I_GRP		/* Metaconfig. */
#		if !(__UNIX__ || \
		     __TOS__ && __GNUC__	|| \
		     /* Add other systems known to have it here. */0)
#		    define _I_GRP	-1
#		endif
#	    endif
#	endif
#   endif

#   ifndef _I_PWD
#	ifdef HAVE_PWD_H		/* Autoconfig. */
#	    if (2* HAVE_PWD_H -1==-1)
#		define _I_PWD	-1
#	    endif
#	else
#	    ifndef I_PWD		/* Metaconfig. */
#		if !(__UNIX__ || \
		     __TOS__ && __GNUC__	|| \
		     /* Add other systems known to have it here. */0)
#		    define _I_PWD	-1
#		endif
#	    endif
#	endif
#   endif

#   ifndef _I_SYS_STAT
#	ifdef HAVE_SYS_STAT_H	/* Autoconfig. */
#	    if (2* HAVE_SYS_STAT_H -1==-1)
#		define _I_SYS_STAT	-1
#	    endif
#	else
#	    ifndef I_SYS_STAT	/* Metaconfig. */
#		if !(__UNIX__ || \
		     __TOS__ || \
		     __MSDOS__ || \
		     /* Add other systems known to have it here. */0)
#		    define _I_SYS_STAT	-1
#		endif
#	    endif
#	endif
#   endif
#   if !(_I_SYS_STAT - -1)
#	ifndef _I_STAT
#	    if (2* HAVE_STAT_H -1!=-1	/* Autoconfig. */	|| \
		2* I_STAT -1!=-1	/* Metaconfig. */	|| \
		__VMS__ && VAXC	|| \
		/* Add other systems known to have it here. */0)
#		define _I_STAT	1
#	    endif
#	endif
#   endif

#   ifndef _I_SYS_TIMES
#	ifdef HAVE_SYS_TIMES_H	/* Autoconfig. */
#	    if (2* HAVE_SYS_TIMES_H -1==-1)
#		define _I_SYS_TIMES	-1
#	    endif
#	else
#	    ifndef I_SYS_TIMES	/* Metaconfig. */
#		if !(__UNIX__ || \
		     __TOS__ && __GNUC__ || \
		     /* Add other systems known to have it here. */0)
#		    define _I_SYS_TIMES	-1
#		endif
#	    endif
#	endif
#   endif

#   ifndef _I_SYS_TYPES
#	ifdef HAVE_SYS_TYPES_H	/* Autoconfig. */
#	    if (2* HAVE_SYS_TYPES_H -1==-1)
#		define _I_SYS_TYPES	-1
#	    endif
#	else
#	    ifndef I_SYS_TYPES	/* Metaconfig. */
#		if !(__UNIX__ || \
		     __TOS__ || \
		     __MSDOS__ || \
		     /* Add other systems known to have it here. */0)
#		    define _I_SYS_TYPES	-1
#		endif
#	    endif
#	endif
#   endif
#   if !(_I_SYS_TYPES - -1)
#	ifndef _I_TYPES
#	    if (2* HAVE_TYPES_H -1!=-1	/* Autoconfig. */	|| \
		2* I_TYPES -1!=-1	/* Metaconfig. */	|| \
		__VMS__ && VAXC	|| \
		/* Add other systems known to have it here. */0)
#		define _I_TYPES	1
#	    endif
#	endif
#   endif

#   ifndef _I_SYS_UTSNAME
#	if (2* HAVE_SYS_UTSNAME_H -1!=-1	/* Autoconfig. */	|| \
	    2* I_SYS_UTSNAME -1!=-1	/* Metaconfig. */	|| \
	    /* Add other systems known to have it here. */0)
#	    define _I_SYS_UTSNAME	1
#	endif
#   endif

#   ifndef _I_SYS_WAIT
#	if (2* HAVE_SYS_WAIT_H -1!=-1	/* Autoconfig. */	|| \
	    2* I_SYS_WAIT -1!=-1	/* Metaconfig. */	|| \
	    __BSD__ || \
	    /* Add other systems known to have it here. */0)
#	    define _I_SYS_WAIT	1
#	endif
#   endif

#   if !_I_SYS_WAIT
#	ifndef _I_WAIT
#	    if (2* HAVE_WAIT_H -1!=-1	/* Autoconfig. */	|| \
		2* I_WAIT -1!=-1	/* Metaconfig. */	|| \
		/* Add other systems known to have it here. */0)
#		define _I_WAIT	1
#	    endif
#	endif
#   endif

#   ifndef _I_TAR	/* Most UNIX systems seem to have <tar.h> nowadays. */
#	if (2* HAVE_TAR_H -1!=-1	/* Autoconfig. */	|| \
	    2* I_TAR -1!=-1		/* Metaconfig. */	|| \
	    __UNIX__ && !(pdp11 || \
			  /* add other defective systems here. */0))
#	    define _I_TAR	1
#	endif
#   endif

#   ifndef _I_TERMIOS
#	if (2* HAVE_TERMIOS_H -1!=-1	/* Autoconfig. */	|| \
	    2* I_TERMIOS -1!=-1		/* Metaconfig. */	|| \
	    /* Add other systems known to have it here. */0)
#	    define _I_TERMIOS	1
#	endif
#   endif
#   if !_I_TERMIOS
#	ifndef _I_TERMIO
#	    if (2* HAVE_TERMIO_H -1!=-1	/* Autoconfig. */	|| \
		2* I_TERMIO -1!=-1	/* Metaconfig. */	|| \
		__SYSV__ || \
		/* Add other systems known to have it here. */0)
#		define _I_TERMIO	1
#	    endif
#	endif
#	if !_I_TERMIO
#	    ifndef _I_SGTTY
#		ifdef HAVE_SGTTY_H	/* Autoconfig. */
#		    if (2* HAVE_SGTTY_H -1==-1)
#			define _I_SGTTY	-1
#		    endif
#		else
#		    ifndef I_SGTTY	/* Metaconfig. */
#			if !(__UNIX__ || \
			    __TOS__ && __GNUC__ || \
			    /* Add other systems known to have it here. */0)
#			    define _I_SGTTY	-1
#			endif
#		    endif
#		endif
#	    endif
#	endif
#   endif

#   ifndef _I_UTIME
#	if (2* HAVE_UTIME_H -1!=-1	/* Autoconfig. */	|| \
	    2* I_UTIME -1!=-1		/* Metaconfig. */	|| \
	    __SYSV__ || \
	    __MINIX__ || \
	    /* Add other systems known to have it here. */0)
#	    define _I_UTIME	1
#	endif
#   endif

#endif /* !__POSIX__ */


/* Data types mandated by ANSI: size_t, ptrdiff_t */

#ifndef size_t
#   ifndef _SIZE_T_	/* commonly used definition tag. */
#	if _ANSI_HEADERS_
	    /* {{These multiple-inclusion tag checks are not strictly necessary
		 since ANSI C explicitly allows multiple inclusion.}} */
#	    ifndef _STDDEF_H_
#		ifndef _STDDEF_H
#		    ifndef __STDDEF
#			include <stddef.h>
#		    endif
#		endif
#		define _STDDEF_H_
#	    endif
#	else
	    /* {{WARNING! Some older UNIX systems don't declare `size_t'
		 in <sys/types.h>.  Those that don't should be added to the
		 exception list below.
		 And those that do, do not always protect the header against
		 multiple inclusions.
		 So if you need <sys/types.h>, either include it AFTER this
		 file #ifndef _SYS_TYPES_H_, or include it BEFORE this file,
		 then explicitly #define _SYS_TYPES_H_ yourself.}} */

#	    if (__UNIX__ && !(pdp11 || \
			      /* {{Add other exceptions here.}} */0))
#		ifndef _SYS_TYPES_H_
#		    include <sys/types.h>
#		    define _SYS_TYPES_H_
#		endif
#	    else
		/* {{Pre-define _SIZE_T_ for compilers/systems that
		     are known to need long instead of int here.}} */

#		ifdef _SIZE_T_
#		    if _HAS_UNSIGNED_
			typedef unsigned long	size_t;
#		    else
			typedef long		size_t;
#		    endif
#		else
			typedef int		size_t;
#		endif
#	    endif
#	endif
#	define _SIZE_T_
#   endif
#endif


#ifndef __STRICT_POSIX__	/* Strict Posix shouldn't define this. */
#   ifndef ptrdiff_t
#	ifndef _PTRDIFF_T_	/* commonly used definition tag. */
#	    if _ANSI_HEADERS_
#		ifndef _STDDEF_H_
#		    ifndef _STDDEF_H
#			ifndef __STDDEF
#			    include <stddef.h>
#			endif
#		    endif
#		    define _STDDEF_H_
#		endif
#	    else
		/* {{Pre-define _PTRDIFF_T_ for compilers/systems that
		     are known to need long instead of int, here.}} */

#		ifdef _PTRDIFF_T_
			typedef long	ptrdiff_t;
#		else
			typedef int	ptrdiff_t;
#		endif
#	    endif
#	    define _PTRDIFF_T_
#	endif
#   endif
#endif

/* Data types mandated by Posix: ssize_t */

#ifndef ssize_t
#   ifndef _SSIZE_T_	/* commonly used definition tag. */
#	if (__POSIX__ && _POSIX_VERSION >= 199009L)
	    /* `ssize_t' was introduced in the 1990 draft revision. */
#	    ifndef _SYS_TYPES_H_
#		include <sys/types.h>
#		define _SYS_TYPES_H_
#	    endif
#	else
	    /* {{WARNING: sizeof(ssize_t) should be equal to sizeof(size_t)!
		 Pre-define _SSIZE_T_ for compilers/systems that are known
		 to need long instead of int, here.}} */

#	    if __MSHORT__
#		ifdef __GNUC__
#		    define _SSIZE_T_
#		endif
#	    endif
#	    if (__TURBOC__ && __TOS__)
#		define _SSIZE_T_
#	    endif

#	    ifdef _SSIZE_T_
		typedef long	ssize_t;
#	    else
		typedef int	ssize_t;
#	    endif
#	endif
#	define _SSIZE_T_
#   endif
#endif

/*
 * offsetof(type, field)
 */
#ifndef __STRICT_POSIX__
#   ifndef offsetof
#	if _ANSI_HEADERS_
#	    ifndef _STDDEF_H_
#		ifndef _STDDEF_H
#		    ifndef __STDDEF
#			include <stddef.h>
#		    endif
#		endif
#		define _STDDEF_H_
#	    endif
#	else
#	    define offsetof(type,field)	\
		((size_t)((char*)&((type*)0)->field - (char*)0))
#	endif
#   endif
#endif

/*
 * Portability kludges.
 */
#if _ANSI_PROTO_
#   ifndef _LIBC_NEEDS_PROMOTION
#	if ((__GNUC__ && sun) /* Gnu C with sun <4.1 native library */ || \
	    NeXT || \
	    /* Add other hybrid systems here. */0)
#	    define _LIBC_NEEDS_PROMOTION	1
#	endif
#   endif

#   if (2* _LIBC_NEEDS_PROMOTION -1 != 2* 0 -1)
#	define _PI_LIBC_(type)	int
#   else
#	define _PI_LIBC_(type)	type
#   endif
/* {{NOTE: this is similar to, but independent of, the definition of _PI_}} */
#endif

/*
 * Conflicting return types.
 * (that I have encountered in non-ANSI standard library headers thus far)
 */
#if !_ANSI_LIBRARY_

#   ifndef _P_TRADITIONAL_RETURN_TYPES
	/* exit(), abort(), etc. are traditionally declared with return
	   type `int' -- which conflicts with the ANSI-style declarations. */
#	if (sun || \
	    /* add other traditional systems here. */0)
#	    define _P_TRADITIONAL_RETURN_TYPES	1
#	endif
#   endif

#   ifndef _P_ABORT_RETURN_TYPE
#	if (_P_TRADITIONAL_RETURN_TYPES || \
	    /* Add other systems here. */0)
#	    define _P_ABORT_RETURN_TYPE	int
#	endif
#   endif
#   ifndef _P_EXIT_RETURN_TYPE
#	if (_P_TRADITIONAL_RETURN_TYPES || \
	    /* Add other systems here. */0)
#	    define _P_EXIT_RETURN_TYPE	int
#	endif
#   endif
#   ifndef _P_FREE_RETURN_TYPE
#	if (_P_TRADITIONAL_RETURN_TYPES || \
	    /* Add other systems here. */0)
#	    define _P_FREE_RETURN_TYPE	int
#	endif
#   endif
#   ifndef _P_QSORT_RETURN_TYPE
#	if (_P_TRADITIONAL_RETURN_TYPES || \
	    /* Add other systems here. */0)
#	    define _P_QSORT_RETURN_TYPE	int
#	endif
#   endif
#   ifndef _P_SPRINTF_RETURN_TYPE
#	if (_P_TRADITIONAL_RETURN_TYPES || \
	    2* CHARSPRINTF -1 != 2* 0 -1 /* Metaconfig. */ || \
	    _KNR_ANTIQUE_ || \
	    ultrix || \
	    /* Add other systems here. */0)
#	    define _P_SPRINTF_RETURN_TYPE	char *
#	endif
#   endif
#   ifndef _P_SRAND_RETURN_TYPE
#	if (_P_TRADITIONAL_RETURN_TYPES || \
	    /* Add other systems here. */0)
#	    define _P_SRAND_RETURN_TYPE	int
#	endif
#   endif
#   if (_P_TRADITIONAL_RETURN_TYPES || \
	/* add other systems here. */0)
	/* Cheat for malloc() and friends. */
#	undef void_
#	define void_	char
#   endif
#endif

#endif /* _PORTDEFS_H_ */



/* Portability options.  (provided only if explicitly requested) */


#ifdef _PORT_TYPES	/* Provide various general datatypes. */

# ifndef _PORT_BWL_TYPES
#   define _PORT_BWL_TYPES	1/* BYTE-WORD-LONG (from [TRH] "portab.h") */

#   if ((_PORT_TYPES-0) & _PORT_BWL_TYPES || (2*_PORT_TYPES-1==2*-1))
	typedef signed char	BYTE;	/* signed? 8 bit integer */
	typedef short		WORD;	/* signed 16 bit int	*/
	typedef long		LONG;	/* signed 32 bit int	*/
	typedef int		INT;	/* generic integer	*/
	typedef unsigned int	UINT;	/* generic unsigned integer */
#	if _HAS_UNSIGNED_
	typedef unsigned char	UBYTE;	/* unsigned 8 bit int	*/
	typedef unsigned short	UWORD;	/* unsigned 16 bit int	*/
	typedef unsigned long	ULONG;	/* unsigned 32 bit int	*/
#	else		/* This is all we can do... (and hope for the best) */
	typedef char		UBYTE;	/* unsigned? 8 bit int	*/
#	    if __MSHORT__
	typedef unsigned int	UWORD;	/* unsigned 16 bit int	*/
	typedef long		ULONG;	/* unsigned? 32 bit int	*/
#	    else
	typedef short		UWORD;	/* unsigned? 16 bit int	*/
	typedef unsigned int	ULONG;	/* unsigned 32 bit int	*/
#	    endif
#	endif /* _HAS_UNSIGNED_ */
	typedef UBYTE *		ADDRESS; /* general (non-void *) address */
	typedef char *		STRING;	/* pointer to string */

#	define BOOLEAN	int
#	define BOOL	WORD
#	define BBOOL	BYTE
#	define WBOOL	WORD
#	define LBOOL	LONG
#   else
#	undef _PORT_BWL_TYPES
#   endif
# endif /* _PORT_BWL_TYPES */

# ifndef _PORT_INTN_TYPES
#   define _PORT_INTN_TYPES	2/* INT{1,2,4} (from [GCThW] "portdef.h") */

#   if ((_PORT_TYPES-0) & _PORT_INTN_TYPES)
	/* {{NOTE: I [TRH] made the `XXX_pt' pointer defs optional since these
	     look too much like a mis-typed `XXX_tp' in my opinion.}} */
#	define _PORT_pt	0x8000
#	if ((_PORT_TYPES-0) & _PORT_pt)
#	    define _PT(x)	, *x
#	else
#	    define _PT(x)
#	endif

	typedef char		CHAR_tp _PT(CHAR_pt);	/* generic character	*/
	typedef signed char	INT1_tp _PT(INT1_pt);	/* signed? 8 bit integer */
	typedef short		INT2_tp _PT(INT2_pt);	/* signed 16 bit int	*/
	typedef long		INT4_tp _PT(INT4_pt);	/* signed 32 bit int	*/
	typedef int		INT_tp  _PT(INT_pt);	/* generic integer	*/
	typedef unsigned int	UINT_tp _PT(UINT_pt);	/* generic unsigned integer */
#	if _HAS_UNSIGNED_
	typedef unsigned char	UINT1_tp _PT(UINT1_pt);	/* unsigned 8 bit int	*/
	typedef unsigned short	UINT2_tp _PT(UINT2_pt);	/* unsigned 16 bit int	*/
	typedef unsigned long	UINT4_tp _PT(UINT4_pt);	/* unsigned 32 bit int	*/
#	else		/* This is all we can do... (and hope for the best) */
	typedef char		UINT1_tp _PT(UINT1_pt);	/* unsigned? 8 bit int	*/
#	    if __MSHORT__
	typedef unsigned int	UINT2_tp _PT(UINT2_pt);	/* unsigned 16 bit int	*/
	typedef long		UINT4_tp _PT(UINT4_pt);	/* unsigned? 32 bit int	*/
#	    else
	typedef short		UINT2_tp _PT(UINT2_pt);	/* unsigned? 16 bit int	*/
	typedef unsigned int	UINT4_tp _PT(UINT4_pt);	/* unsigned 32 bit int	*/
#	    endif
#	endif /* _HAS_UNSIGNED_ */
	typedef UINT1_tp	UCHAR_tp _PT(UCHAR_pt);	/* unsigned char	*/
	typedef UINT1_tp	*ADDRESS_tp;	/* general (non-void *) address */
	typedef CHAR_tp		*STRING_tp _PT(STRING_pt); /* pointer to string. */

#	undef _PT

	/* {{These values assume 2's complement arithmetic; if necessary,
	     the range is limited to avoid sign-extension problems.}} */

#	if (_ANSI_signed_  || !__CHAR_UNSIGNED__)
#	    define MIN_INT1	((INT1_tp)0x80)
#	else
#	    define MIN_INT1	MIN_UINT1
#	endif
#	define MIN_INT2		((INT2_tp)0x8000)
#	define MIN_INT4		((INT4_tp)0x80000000L)

#	define MIN_UINT1	((UINT1_tp)0)
#	define MIN_UINT2	((UINT2_tp)0)
#	define MIN_UINT4	((UINT4_tp)0)

#	define MAX_INT1		((INT1_tp)0x7F)
#	define MAX_INT2		((INT2_tp)0x7FFF)
#	define MAX_INT4		((INT4_tp)0x7FFFFFFFL)

#	if (_HAS_UNSIGNED_ || __CHAR_UNSIGNED__)
#	    define MAX_UINT1	((UINT1_tp)0xFF)
#	else
#	    define MAX_UINT1	MAX_INT1
#	endif
#	if (_HAS_UNSIGNED_ || __MSHORT__)
#	    define MAX_UINT2	((UINT2_tp)0xFFFF)
#	else
#	    define MAX_UINT2	MAX_INT2
#	endif
#	if (_HAS_UNSIGNED_ || !__MSHORT__)
#	    define MAX_UINT4	((UINT4_tp)0xFFFFFFFF)
#	else
#	    define MAX_UINT4	MAX_INT4
#	endif

	/* Swap the range of a 2's complement integer, from unsigned to signed
	   and vice versa.  So, INT1 should swap -128..127 and 0..255, etc.
	   Simply XOR-ing the sign bit should do the trick. */

#	define int1_TC_swaprange(x)	((x)^0x80)
#	define int2_TC_swaprange(x)	((x)^0x8000)
#	define int4_TC_swaprange(x)	((x)^0x80000000L)

#	define BOOLEAN	int
#   else
#	undef _PORT_INTN_TYPES
#   endif
# endif /* _PORT_INTN_TYPES */

#   if (((_PORT_TYPES-0) & ~(1|2)) ||
	((_PORT_TYPES-0) == 0 && !(2*_PORT_TYPES-1==2*-1)))
	#error "_PORT_TYPES should be empty or a combination of _PORT_{BWL,INTN}_TYPES"
#   endif
#   undef _PORT_TYPES
#endif /* _PORT_TYPES */


#ifndef NULL		/* (possibly from <stddef.h>) */
#   define NULL	0
#endif


#ifdef _PORT_CONSTS	/* Provide various constants. */
#ifndef _PORTCONSTS_INCLUDED_
#define _PORTCONSTS_INCLUDED_

/* Enforce the next defines: */

			/*	Null pointer.		*/
#undef NIL
#define NIL	((void_*)0)
			/*	Null character.		*/
#undef NUL
#define NUL	'\0'
			/*	EOF Value		*/
#undef EOF
#define EOF	(-1)
			/*	Boolean values		*/
#undef TRUE
#define TRUE	1
#undef FALSE
#define FALSE	0
			/*	OK return value		*/
#undef OK
#define OK	0
			/*	ERRor return value	*/
#undef ERR
#define ERR	(-1)

#endif /* _PORTCONSTS_INCLUDED_ */
#undef _PORT_CONSTS
#endif /* _PORT_CONSTS */


#ifdef _PORT_FUNCTIONS	/* Provide system-dependent function aliases. */

# ifndef _PORT_CHR_FUNCTIONS
#   if _ANSI_HEADERS_ || _I_STRING
#	include <string.h>
#   else
#	include <strings.h>
#   endif
#   define _PORT_CHR_FUNCTIONS	1

#   if ((_PORT_FUNCTIONS-0) & _PORT_CHR_FUNCTIONS || (2*_PORT_FUNCTIONS-1==2*-1))
#	if _ANSI_LIBRARY_
#	    ifndef index
#		define index	strchr
#	    endif
#	    ifndef rindex
#		define rindex	strrchr
#	    endif
#	else /* !_ANSI_LIBRARY_ */ /* (assume traditional BSD library) */
#	    ifndef strchr
#		define strchr	index
#	    endif
#	    ifndef strrchr
#		define strrchr	rindex
#	    endif
#	endif /* !_ANSI_LIBRARY_ */
#   else
#	undef _PORT_CHR_FUNCTIONS
#   endif
# endif /* _PORT_CHR_FUNCTIONS */

# ifndef _PORT_MEM_FUNCTIONS
#   define _PORT_MEM_FUNCTIONS	2

#   if ((_PORT_FUNCTIONS-0) & _PORT_MEM_FUNCTIONS || (2*_PORT_FUNCIONS-1==2*-1))
#	if _ANSI_LIBRARY_
#	    ifndef bcmp
#		define bcmp(p,q,n)	memcmp(p,q,(size_t)(n))
#	    endif
#	    ifndef bcopy
#		define bcopy(s,d,n)	((void)memcpy(d,s,(size_t)(n)))
#	    endif
#	    ifndef bzero
#		define bzero(p,n)	memset(p,0,(size_t)(n))
#	    endif
#	else /* !_ANSI_LIBRARY_ */	/* Assume traditional BSD library. */
#	    ifndef memcmp
#		define memcmp(p,q,n)	bcmp(p,q,(int)(n))
#	    endif
#	    ifndef memcpy
#		define memcpy(d,s,n)	bcopy(s,d,(int)(n))
#	    endif
	    /* sorry, cannot handle memset. */
#	endif /* !_ANSI_LIBRARY_ */
#   else
#	undef _PORT_MEM_FUNCTIONS
#   endif
# endif /* _PORT_MEM_FUNCTIONS */

#   if (((_PORT_FUNCTIONS-0) & ~(1|2)) || \
	(_PORT_FUNCTIONS-0 == 0 && !(2*_PORT_FUNCTIONS-1==2*-1)))
	#error "_PORT_FUNCTIONS should be empty or a combination of _PORT_{STR,MEM}_FUNCTIONS."
#   endif
#   undef _PORT_FUNCTIONS
#endif /* _PORT_FUNCTIONS */


#ifdef _PORT_KEYWORDS

# ifndef _PORT_GNUC_KEYWORDS
#   define _PORT_GNUC_KEYWORDS	1

#   if ((_PORT_KEYWORDS-0) & _PORT_GNUC_KEYWORDS)
/*
 * Gnu C-style keyword extensions:
 *
 *	__attribute__(attrlist)		- storage attributes
 *	__extension__			- explicit Gnu C extension
 *	__inline__			- inline functions
 *
 *	__const__			- functions without side-effects
 *	__exiting__			- functions that do not return
 *
 * other, more fundamental, Gnu C language extensions cannot be so easily
 * hidden.
 */
#	ifndef __attribute__
#	    if (__GNUC__-0 < 2)		/* new in GCC v2.0 */
#		define __attribute__(x)
#	    endif
#	endif
#	ifndef __const__
#	    ifdef __GNUC__
#		define __const__	const
#	    else
#		define __const__
#	    endif
#	endif
#	ifndef __exiting__
#	    ifdef __GNUC__
#		define __exiting__	volatile
#	    else
#		define __exiting__
#	    endif
#	endif
#	ifndef __extension__
#	    ifndef __GNUC__
#		define __extension__
#	    endif
#	endif
#	ifndef __inline__
#	    ifndef __GNUC__
#		define __inline__
#	    endif
#	endif
#   else
#	undef _PORT_GNUC_KEYWORDS
#   endif
# endif /* _PORT_GNUC_KEYWORDS */

# ifndef _PORT_DOS_KEYWORDS	/* Provide dummy DOS keywords for non-DOS compilers */
#   define _PORT_DOS_KEYWORDS	2

#   if ((_PORT_KEYWORDS-0) & _PORT_DOS_KEYWORDS)
#	if !__MSDOS__
#	    define far
#	    define huge
#	    define near
	    /* ...and probably much more??? */
#	    if !(__TOS__ && __TURBOC__)
#		define cdecl
#	    endif
#	endif
#	if !__TURBOC__
#	    define pascal
#	endif
#   else
#	undef _PORT_DOS_KEYWORDS
#   endif
# endif /* _PORT_DOS_KEYWORDS */

# ifndef _PORT_TOS_KEYWORDS	/* Similar to the above, but for TOS (Atari ST) code. */
#   define _PORT_TOS_KEYWORDS	4

#   if ((_PORT_KEYWORDS-0) & _PORT_TOS_KEYWORDS)
#	if !(__TOS__ && __TURBOC__)
#	    if !__DOS__
#		define cdecl
#	    endif
#	    define pascal
#	endif
#   else
#	undef _PORT_TOS_KEYWORDS
#   endif
# endif /* _PORT_TOS_KEYWORDS */

#   if (((_PORT_KEYWORDS-0) & ~(1|2|4)) || (_PORT_KEYWORDS-0) == 0)
	#error "_PORT_KEYWORDS should be a combination of _PORT_{GNUC,DOS,TOS}_KEYWORDS"
#   endif
#   undef _PORT_KEYWORDS
#endif /* _PORT_KEYWORDS */


#ifdef _PORT_STYLE	/* Provide style options. */

# ifndef _PORT_REG_STYLE
#   define _PORT_REG_STYLE	1

#   if ((_PORT_STYLE-0) & _PORT_REG_STYLE)
#	define REG	register
#	if (m68k || mc68000 || __TOS__ || vax)
#	    define REGL	REG
#	else
#	    define REGL	/* low-priority register. */
#	endif
#   else
#	undef _PORT_REG_STYLE
#   endif
# endif /* _PORT_REG_STYLE */

#   ifndef __CPLUSPLUS__
#	ifndef __cplusplus
#	    define public
#	    define private	static
#	endif
#   endif

#   ifdef _PORT_GNUC_KEYWORDS
#	define exiting		__exiting__
#	ifndef __GNUC__
#	    define inline	__inline__
#	endif
#   endif

#   if (((_PORT_STYLE-0) & ~(1)) || \
	((_PORT_STYLE-0) == 0 && !(2*_PORT_STYLE-1==2*-1)))
	#error "_PORT_STYLE should be empty or _PORT_REG_STYLE"
#   endif

#   undef _PORT_STYLE
#endif /* _PORT_STYLE */


#ifdef _PORT_FILENAME	/* Some file name related macros. */
# ifndef _PORTFILENAME_INCLUDED_
# define _PORTFILENAME_INCLUDED_

#   if !(__DOS__ || __TOS__)	/* UNIX-style filenames. */
#	define SLASH		'/'
#	define SLASH_str	"/"
#	define isabsf(fnm)	((fnm)[0] == SLASH)
#	ifndef PATH_MAX		/* obsolescent; should use _POSIX_PATH_MAX. */
#	    define PATH_MAX	1024
#	endif
#   else /* (__DOS__ || __TOS__) */
#	define SLASH		'\\'
#	define SLASH_str	"\\"
#	ifndef PATH_MAX
#	    ifndef _MAX_PATH
#		define PATH_MAX	128
#	    else
#		define PATH_MAX	_MAX_PATH
#	    endif
#	endif
#   endif /* (__DOS__ || __TOS__) */

#   ifndef _MAX_PATH
#	define _MAX_PATH	PATH_MAX
#   endif
# endif /* _PORTFILENAME_INCLUDED */
# undef _PORT_FILENAME
#endif /* _PORT_FILENAME */


#ifdef _PORT_ERROR	/* Some frequently used (by me [TRH]) declarations. */
# ifndef _PORTERROR_INCLUDED_
# define _PORTERROR_INCLUDED_
	extern void	error	__(( const char *_(fmt) ___ ));
	extern void	puterr	__(( const char *_(fmt) ___ ));
# endif
# undef _PORT_ERROR
#endif


/*======================================================================*
 * $Log: portdefs.h,v $
 * Revision 1.13  1993/02/02  21:00:42  gerben
 * *** empty log message ***
 *
 * Revision 1.12  1993/01/28  15:21:54  tom
 * some textual cleanups; fix _PORT_INTN_TYPES, add _PORT_pt compatibility
 * option; move _PORT_STYLE beyond _PORT_KEYWORDS.
 *
 * Revision 1.11  1992/12/30  12:38:04  tom
 * add support for traditional return types to avoid conflicts with ditto system headers;
 * move inclusion of <unistd.h> after "portansi.h" since that can redefine void.
 *
 * Revision 1.10  1992/12/22  14:56:29  tom
 * add _LIBC_NEEDS_PROMOTION, _P_<function>_RETURN_TYPE kludges; include proper
 * string header for _PORT_FUNCTIONS.
 *
 * Revision 1.9  1992/12/18  22:57:45  tom
 * remove sun from _ANSI_HEADERS_ list; add _I_NDIR/_I_SYS_NDIR/_I_SYS_DIR
 * as alternatives to _I_DIRENT.
 *
 * Revision 1.8  1992/10/27  13:07:48  tom
 * add mips (Ultrix) tentatively; add some missing line continuations;
 * change parenthesis order (_PORT_XXX)-0 => (_PORT_XXX-0) to allow empty def.
 *
 * Revision 1.7  1992/10/23  04:11:14  tom
 * update description; major revision of _I_<header> handling; add generic
 * __SYSV__ and __BSD__ flags; use `void_*'.
 *
 * Revision 1.6  1992/10/21  19:40:23  tom
 * some comment changes.
 *
 * Revision 1.5  1992/10/20  16:52:20  tom
 * revert to __STRICT_POSIX__; add _I_WAIT if not _I_SYS_WAIT; similarly,
 * add _I_TERMIO if not _I_TERMIOS, add _I_SGTTY if not _I_TERMIO (default
 * undefined for Unix; (-1) for non-Unix systems.
 *
 * Revision 1.4  1992/10/09  07:07:34  tom
 * add _I_<header> flags; add GNU Autoconfig/LWall Metaconfig compatibility;
 * replace __STRICT_POSIX__ with _POSIX_SOURCE since that is its meaning all
 * along (as I understood it, at least); add some comments.
 *
 * Revision 1.3  1992/10/03  01:01:26  tom
 * add copyleft; rename _PORT_STR_FUNCTIONS to _PORT_CHR_FUNCTIONS to avoid
 * 8-char significance conflict with _PORT_STYLE; group _PORT_{GNUC,DOS,TOS}
 * as _PORT_KEYWORDS options; allow multiple inclusions to define specific
 * optional _PORT_XXX features if required in other header files.
 *
 * Revision 1.2  1992/09/16  20:46:46  tom
 * add summary description; improve handling of pre-defined options;
 * add `offsetof()'; add configuration options: _PORT_GNUC, _PORT_TYPES,
 * (= _PORT_{BWL,INTN}_TYPES), _PORT_FUNCTIONS (= _PORT_{STR,MEM}_FUNCTIONS),
 * _PORT_STYLE (= _PORT_REG_STYLE), _PORT_DOS, _PORT_TOS, _PORT_FILENAME,
 * _PORT_ERROR.
 *
 * Revision 1.1  1992/09/14  04:43:40  tom
 * Initial revision
 *
 *======================================================================*/

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.