⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rabbit.h

📁 界面程序
💻 H
字号:
/************************************************************************

NAME:
	rabbit.h

DESCRIPTION:
	Rabbit Standard type and name declarations.

	This version of "rabbit.h" is specific to ISC and SCO Unix
	systems.

	Copyright 1985-1992 by Rabbit Software Corporation
	
*************************************************************************/

#ifndef	RABBIT

#define	RABBIT	"Copyright 1984-1992 by Rabbit Software Corporation"

#ifdef HEADERVERSIONS
static char *_rabbit_h_ = "@(#)rabbitSYSV.h	1.23 !R2";
#endif /* HEADERVERSIONS */

#include <sys/param.h>			/* for NOFILES_MAX value */

/* Type definitions */

typedef	int		filedesc;	/* file descriptor. */

typedef	long		lbits;		/* 32+ bits used as bitmask */
typedef	short		bits;		/* 16+ bits used as bitmask */
typedef	char		cbits;		/* 8+  bits used as bitmask */

typedef	short		bool;		/* 16+ bits used as flag */
typedef	char		flag;		/* 8+  bits used as flag */

typedef unsigned char	byte;		/* 8 bit unsigned thing  */
typedef unsigned short	word;		/* 16 bit unsigned thing   */
typedef unsigned int	dword;		/* 32 bit unsigned thing */

typedef	char		cint;		/* 8+ bits considered signed */

typedef	int		rchar;		/* Input function return values */
typedef rchar		(*pRcharFcn)(); /* pointer to rchar function; supplied
					   for convenience and to get past
					   certain C sytax constraints. */

typedef	void		VOID;		/* Work around FOS C 2.0 bug */

typedef char		*string;	/* for readability */

typedef int		PID;		/* pid type - can change */

typedef void		sighndl;	/* type of signal handling function */
					/* NOTE: this is port specific - some
					         systems expect int, others
						 expect void
					*/

#define NO_SIGNAL	-1		/* "no signal" initializer */
#define BADSIGHNDL	((sighndl(*)())-1) /* illegal signal handler value */
#define BADSIG		BADSIGHNDL	/* backward compatibility */

#ifdef LINT
typedef char		*anypointer;	/* holds any pointer 		*/
#else
typedef void		*anypointer;	/* holds any pointer 		*/
					/* if not supported use char *	*/
#endif
		 

#define USERNAMELEN	8
#define MAXNAMELEN	14
#define MAXPATHLEN	PATHSIZE		/* defined in <sys/param.h> */
typedef char		PathName[MAXPATHLEN];	/* Path name variable */

#define MAXDEVPATHLEN	32
typedef char DevPath[MAXDEVPATHLEN];		/* Device name variable */

#define MAXADDRLEN	4			/* Maximum address length -
						   max size of pointer	   */

#define MAXDIGITS	10			/* maximum number of decimal
						   digits.  Number in largest
						   unsigned long */

#define MAX_FDS		NOFILES_MAX		/* maximum number of file
						   descriptors a process may
						   have open at one time */

#define LANGVAR		"RLANG"			/* Rabbit language string for
						   map database logical name
						   that defines National
						   Language.	*/

/* system macros   */

#define rgetpid() getpid()
#define rfork() fork()
#define rgetuid() getuid()
#define rsetuid(x) setuid(x)
#define rsetgid(x) setgid(x)
#define rexecv(x,y) execv(x,y)

/* Standard macros */

#define DIM(a)		(sizeof(a)/sizeof(*(a)))	/* length of array */

#define HINIBBL(x)	(((x) >> 4) & 0x0f)	/* Take upper half of byte */
#define LONIBBL(x)	((x) & 0x0f)		/* Take lower half of byte */
#define HINYBBLE(x)	HINIBBL(x)		/* properly spelled version */
#define LONYBBLE(x)	LONIBBL(x)		/* properly spelled version */

#define HIBYTEMSK	(0xff00)		/* Mask to get high byte
						   without shifting */
#define LOBYTEMSK	(0xff)			/* Just to be consistent */

#define	LURSHIFT(n, b)	(((long)(n) >> (b)) & (0x7fffffffL >> ((b)-1)))
#define HIBYTE(x)	(((x) >> 8) & 0xff)	/* Take upper half of short */
#define LOBYTE(x)	((x) & 0xff)		/* Take lower half of short */

#define HIWORD(x)	(((x) >> 16) & 0xffffL) /* Take upper half of long */
#define LOWORD(x)	((x) & 0xffffL)		/* Take lower half of long */

#define BYTE(x)		((x) & 0xff)		/* Truncate byte value */
#define CHAR(x)		((x) & 0x7f)		/* Truncate to 7 bits */
#define WORD(x)		((x) & 0xffffL)		/* Truncate to 16 bits */

#define	DECODE(x)	((int) ((x)-'0'))	/* char digit to int digit */

/* Visibility control */

#define	public				/* functions default to public */
#define	private		static		/* and are hidden if static */
#define local				/* "locally global" within an
					   interface */

/* Compatibility with pre-386 systems */

#define far                             /* for 'far' pointer declarations */

/* Standard constants */

#define TRUE		1		/* for use in booleans */
#define	FALSE		0

#define	SUCCEED		0		/* successful function return */ 
#define	FAIL		-1		/* failure function return */ 

#define EXIT_SUCCEED	0		/* successful exit status */
#define EXIT_FAIL	1		/* failure exit status */

#define pNULL		((char *) 0)	/* NULL pointer. */
#define pbNULL		((byte *) 0)	/* NULL byte pointer. */
#define fNULL		((int (*)()) 0)	/* NULL function pointer. */
#define iNULL		(0)		/* NULL integer. */
#define lNULL		(0L)		/* NULL long. */

#define NULL_CHR    	0
#define EOL		'\n'		/* end of line char */
#define EOS		'\0'		/* end of string char */
#define EOP		'\14'		/* end of page (FF) char */

/* defines for user ids */
#define SUPER_USER_ID	0

/* defines for standard i/o file descriptors:				*/
#define fdSTDIN		0		/* standard input file descr.	*/
#define fdSTDOUT	1		/* standard output file desc.	*/ 
#define fdSTDERR	2		/* standard error file desc.	*/

#define PATHDELIM	'/'		/* Path Delimeter (separator) 	*/
#define S_PATHDELIM	"/"		/* Path Delimeter string	*/

/* access() mode bit definitions - for readability:			*/
#define A_READ		04		/* read				*/
#define A_WRITE		02		/* write			*/
#define A_EXECUTE	01		/* execute			*/
#define A_EXIST		00		/* check existence of file	*/

/* Misc. "no such thing" constants */

#define NO_FD		FAIL            /* closed file descriptor */
#define NO_PID		-2		/* "no process ID" initializer	*/

/* Alignment values - these are useful for situations where various
   data types are being stuffed into an area of memory and proper pointer
   alignment is desired. By default we assume byte alignment is allowed,
   which means the macros don't need to do anything. In the case of an
   alignment boundary of a bigger size, use the commented alignment macros 
   and set ALIGN to the appropriate type (the commented macros will work
   for byte alignments, but are wasteful). 
*/ 
typedef byte 	ALIGN;
#define ALIGN_PTR(p)	(p)
#define ALIGN_SIZ(item)	(sizeof(item))

/*************************************************************************
#define ALIGN_PTR(p)	((p) + ((p) % sizeof(ALIGN)))
#define ALIGN_SIZ(item)	(sizeof(item) + (sizeof(item) % sizeof(ALIGN)))
*************************************************************************/

/* macros for determining maximum and minimum of two given values:	*/
#ifndef MAX
#define MAX(a, b)	(((a) > (b)) ? (a) : (b))
#endif

#ifndef MIN
#define MIN(a, b)	(((a) < (b)) ? (a) : (b))
#endif

#ifndef ABS
#define ABS(a)		((a) < 0 ? (-(a)) : (a))
#endif

/* Macro to convert high byte/low byte sequence to a short. Passed a pointer
   to the high byte (which precedes the low byte), result is a short:
*/
#define BTOS(p) 	((BYTE(*(p)) << 8) + BYTE(*((p) + 1)))

/* Macro to convert a short to high byte/low byte sequence. "s" is the short
   to be converted, "p" is a pointer to the high byte (followed by low byte).
   BEWARE: this macro is 2 instructions -- braces are needed if this is the
           only expression in a loop or conditional statement.
*/
#define STOB(s, p)	(*(p) = HIBYTE(s)); (*((p) + 1) = LOBYTE(s)) 

/* Macro to convert a 4 byte sequence to a long. Bytes must be stored in the
   following order:
   			high byte of high word		(p)
			low byte of high word		(p + 1)
			high byte of low word		(p + 2)
			low byte of low word		(p + 3)
*/
#define BTOL(p)	  ((long) ((((long) BTOS(p)) << 16) + ((long) BTOS((p) + 2))))

/* Macro to convert a long to a byte sequence as described above.
   BEWARE: this macro is 2 instructions -- braces are needed if this is the
           only expression in a loop or conditional statement.
*/
#define LTOB(l, p) STOB((short)HIWORD(l), (p)); STOB((short)LOWORD(l), ((p)+2))

/* native/intel conversion routines */
#ifndef WORDTOI
#define WORDTOI(pWORD, pI)  \
    ( *(((byte *)pI)+1) = *(((byte *)pWORD)+1),\
      *((byte *)pI) = *((byte *)pWORD) )
#define DOUBLETOI(pDOUBLE,pI) \
    ( *(((byte *)pI)+3) = *(((byte *)pDOUBLE)+3),\
      *(((byte *)pI)+2) = *(((byte *)pDOUBLE)+2),\
      *(((byte *)pI)+1) = *(((byte *)pDOUBLE)+1),\
      *((byte *)pI) = *((byte *)pDOUBLE) )
/*
  NOTE: Because ththis is a direct assignment (already in intel format)
  we can use the same macros to convert in either direction.
*/
#define ITOWORD(pI, pWORD)    WORDTOI(pI, pWORD)
#define ITODOUBLE(pI, pDOUBLE)  DOUBLETOI(pI, pDOUBLE)
#endif

/* End of standard declarations */
 
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -