www.pudn.com > vxworks0108.rar > type.h


#ifndef _TYPE_H 
#define _TYPE_H 
 
#ifndef _ASMLANGUAGE 
#ifdef __cplusplus 
extern "C" { 
#endif 
 
#ifndef IMPORT 
#define IMPORT  extern 
#endif 
 
#ifndef START 
#define START int 
#endif 
 
#ifdef _BIG_ENDIAN 
#undef _BIG_ENDIAN 
#endif 
#define _BIG_ENDIAN		1234 
 
#ifdef _LITTLE_ENDIAN 
#undef _LITTLE_ENDIAN 
#endif 
#define _LITTLE_ENDIAN		4321 
 
typedef int size_t; 
 
#define _BYTE_ORDER  _BIG_ENDIAN 
 
typedef	char		INT8; 
typedef	short		INT16; 
typedef	int		INT32; 
typedef	long long	INT64; 
 
typedef	unsigned char	UINT8; 
typedef	unsigned short	UINT16; 
typedef	unsigned int	UINT32; 
typedef	unsigned long long UINT64; 
 
typedef	unsigned char	UCHAR; 
typedef unsigned short	USHORT; 
typedef	unsigned int	UINT; 
typedef unsigned long	ULONG; 
 
typedef	int		BOOL; 
typedef	int		STATUS; 
typedef int 		ARGINT; 
 
typedef void		VOID; 
 
#if !defined(NULL) 
#define NULL ((void *)0) 
#endif 
 
#if	!defined(EOF) || (EOF!=(-1)) 
#define EOF		(-1) 
#endif 
 
#if	!defined(FALSE) || (FALSE!=0) 
#define FALSE		0 
#endif 
 
#if	!defined(TRUE) || (TRUE!=1) 
#define TRUE		1 
#endif 
 
 
#define NONE		(-1)	/* for times when NULL won't do */ 
#define EOS		'\0'	/* C string terminator */ 
 
 
/* return status values */ 
#if !defined(OK) || (OK != 0) 
#define OK		0 
#endif 
 
#if !defined(ERROR) || (ERROR != -1) 
#define ERROR		(-1) 
#endif 
/* timeout defines */ 
 
#define NO_WAIT		0 
#define WAIT_FOREVER	(-1) 
 
/* low-level I/O input, output, error fd's */ 
 
#define	STD_IN	0 
#define	STD_OUT	1 
#define	STD_ERR	2 
 
/* modes - must match O_RDONLY/O_WRONLY/O_RDWR in ioLib.h! */ 
 
#define VX_READ		0 
#define VX_WRITE	1 
 
/* SYSTEM types */ 
 
#define V7		1	/* ATT version 7 */ 
#define SYS_V		2	/* ATT System 5 */ 
#define BSD_4_2		3	/* Berkeley BSD 4.2 */ 
 
/* BUS types */ 
 
#define	BUS_TYPE_NONE	    NONE 
#define BUS_TYPE_VME	    1 
#define BUS_TYPE_MULTIBUS   2 
#define BUS_TYPE_PCI	    3 
 
#define VME_BUS		    BUS_TYPE_VME	/* for backward compat. */ 
#define MULTI_BUS	    BUS_TYPE_MULTIBUS 
 
/* network configuration parameters */ 
 
#define	INET		/* include internet protocols */ 
#undef  BSD             /* remove any previous definition */ 
#define	BSD	44	/* BSD 4.4 like OS */ 
#define	BSDDEBUG	/* turn on debug */ 
#define	GATEWAY		/* tables to be initialized for gateway routing */ 
 
/* common macros */ 
 
#define MSB(x)	(((x) >> 8) & 0xff)	  /* most signif byte of 2-byte integer */ 
#define LSB(x)	((x) & 0xff)		  /* least signif byte of 2-byte integer*/ 
#define MSW(x) (((x) >> 16) & 0xffff) /* most signif word of 2-word integer */ 
#define LSW(x) ((x) & 0xffff) 		  /* least signif byte of 2-word integer*/ 
 
/* swap the MSW with the LSW of a 32 bit integer */ 
#define WORDSWAP(x) (MSW(x) | (LSW(x) << 16)) 
 
#define LLSB(x)	((x) & 0xff)		/* 32bit word byte/word swap macros */ 
#define LNLSB(x) (((x) >> 8) & 0xff) 
#define LNMSB(x) (((x) >> 16) & 0xff) 
#define LMSB(x)	 (((x) >> 24) & 0xff) 
#define LONGSWAP(x) ((LLSB(x) << 24) | \ 
		     (LNLSB(x) << 16)| \ 
		     (LNMSB(x) << 8) | \ 
		     (LMSB(x))) 
 
#define OFFSET(structure, member)	/* byte offset of member in structure*/\ 
		((int) &(((structure *) 0) -> member)) 
 
#define MEMBER_SIZE(structure, member)	/* size of a member of a structure */\ 
		(sizeof (((structure *) 0) -> member)) 
 
#define NELEMENTS(array)		/* number of elements in an array */ \ 
		(sizeof (array) / sizeof ((array) [0])) 
 
#define FOREVER	for (;;) 
 
#define max(x, y)	(((x) < (y)) ? (y) : (x)) 
#define min(x, y)	(((x) < (y)) ? (x) : (y)) 
/*#define isascii(c)	((unsigned) (c) <= 0177) 
#define toascii(c)	((c) & 0177) 
*/ 
 
/* storage class specifier definitions */ 
 
#define FAST	register 
#define IMPORT	extern 
#define LOCAL	static 
#define ROUND_UP(x, align)	(((int) (x) + (align - 1)) & ~(align - 1)) 
#define ROUND_DOWN(x, align)	((int)(x) & ~(align - 1)) 
#define ALIGNED(x, align)	(((int)(x) & (align - 1)) == 0) 
 
#define MEM_ROUND_UP(x)		ROUND_UP(x, _ALLOC_ALIGN_SIZE) 
#define MEM_ROUND_DOWN(x)	ROUND_DOWN(x, _ALLOC_ALIGN_SIZE) 
#define STACK_ROUND_UP(x)	ROUND_UP(x, _STACK_ALIGN_SIZE) 
#define STACK_ROUND_DOWN(x)	ROUND_DOWN(x, _STACK_ALIGN_SIZE) 
#define MEM_ALIGNED(x)		ALIGNED(x, _ALLOC_ALIGN_SIZE) 
 
 
#ifdef __cplusplus 
typedef int 		(*FUNCPTR) (...);     /* ptr to function returning int */ 
typedef void 		(*VOIDFUNCPTR) (...); /* ptr to function returning void */ 
typedef double 		(*DBLFUNCPTR) (...);  /* ptr to function returning double*/ 
typedef float 		(*FLTFUNCPTR) (...);  /* ptr to function returning float */ 
#else 
typedef int 		(*FUNCPTR) ();	   /* ptr to function returning int */ 
typedef void 		(*VOIDFUNCPTR) (); /* ptr to function returning void */ 
typedef double 		(*DBLFUNCPTR) ();  /* ptr to function returning double*/ 
typedef float 		(*FLTFUNCPTR) ();  /* ptr to function returning float */ 
#endif			/* _cplusplus */ 
 
#define FUNCREF(func)   func 
#ifdef __cplusplus 
} 
#endif 
 
#endif 
#endif