/****
 *
 * Copyright 1988 by Sun Microsystems, Inc.
 * @(#)config.h 22.1 89/08/10 Copyright 1988 Sun Micro
 *
 * Machine configuration file
 *
 ****/
#ifndef _SH_CONFIG_
#define _SH_CONFIG_

#define _LITTLEENDIAN	1	/* Least significant bit first */
#define _BIGENDIAN	2	/* Most significant bit first */
#define STD_BIGEND 1

/*
 * Sgn*		-- for use as signed numbers
 * Unsgn*	-- for use as unsigned numbers and bits
 */

#ifdef STD_BIGEND
/*
 * 32 bit ints and longs, 16 bit shorts, 8 bit chars.   Big endian cpu.
 */
typedef long		Sgn32;
typedef short		Sgn16;
typedef char		Sgn8;

typedef unsigned long	Unsgn32;
typedef unsigned short	Unsgn16;
typedef unsigned char	Unsgn8;

#define CPU_BYTE_ORDER	_BIGENDIAN
#define CPU_BIT_ORDER	_BIGENDIAN
#endif

#ifdef STD_LITTLEEND
/*
 * 32 bit ints and longs, 16 bit shorts, 8 bit chars.   Little endian cpu.
 */
typedef long		Sgn32;
typedef short		Sgn16;
typedef char		Sgn8;

typedef unsigned long	Unsgn32;
typedef unsigned short	Unsgn16;
typedef unsigned char	Unsgn8;

#define CPU_BYTE_ORDER	_LITTLEENDIAN
#define CPU_BIT_ORDER	_LITTLEENDIAN
#endif

/*
 * If your display has a different memory layout than your cpu, 
 * these defines will need to be changed accordingly.
 */
#define	FB_BYTE_ORDER	CPU_BYTE_ORDER
#define	FB_BIT_ORDER	CPU_BIT_ORDER

#ifdef SYSV3			
/* 
 * AT&T System V.3 specifics 
 */

struct timeval {
    Sgn32	tv_sec;		/* seconds */
    Sgn32	tv_usec;	/* and microseconds */
};

#define	timerisset(tvp)		((tvp)->tv_sec || (tvp)->tv_usec)

#define	timercmp(tvp, uvp, cmp)	\
	((tvp)->tv_sec cmp (uvp)->tv_sec || \
	 (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)

#define	timerclear(tvp)		(tvp)->tv_sec = (tvp)->tv_usec = 0

#define getdtablesize() 	20
#define getwd(s)		(char *)getcwd(s, 200)
#define vfork()			fork()
#endif

#ifndef	CAT
#undef	IDENT
#define	IDENT(x) x
#define	CAT(a,b) IDENT(a)b
#endif	/* CAT */

#define USE_ALLOCA 1

#if USE_ALLOCA != 0
#include <alloca.h>
#define ALLOCATE_LOCAL(size)    alloca(size)
#define DEALLOCATE_LOCAL(p)     /* P the ALLOCATE_LOCAL return value. */

#else

extern char *malloc();
#define ALLOCATE_LOCAL(size)    palloc((Pool*) NULL, (size))
#define DEALLOCATE_LOCAL(p)     pfree(p)

#endif /* USE_ALLOCA */

#endif /* _SH_CONFIG_ */
