/* $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
*/

/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/


/*	This header file used to be called pcode.h it was	*/ 
/*	moved to libw_pocde.h to avoid including the wrong	*/
/*	version. It is mostly identical to head/pcode.h		*/
/*	except: 						*/
/*		- SS2, SS3 are defined				*/
/*		- _wcsize, wcsize are defined to use a locally	*/
/*		  defined macro, control1(c), instead of using	*/
/*		  the standard macro, iscntrl(x).		*/

#ident	"$Header: libw_pcode.h 1.4 90/04/21 $@(#)libw:inc/pcode.h	1.0"

#ifndef _LIBW_PCODE_H_
/*
 * This header file contains internal macros and definitons
 */

#ifndef	SS2
#define	SS2	0x8E
#endif
#ifndef	SS3
#define	SS3	0x8F
#endif

#define	EUCMASK	0x8080
#define P00	0x0000		/* Code Set 0 */
#define P11	0x8080		/* Code Set 1 */
#define P01	0x0080		/* Code Set 2 */
#define P10	0x8000		/* Code Set 3 */

/*
 *	The followings are for 4 bytes of multi-byte code definition.
 */
#define F_EUCMASK 0x30000000	/* mask bit for 32 bits */
#define F_P00     0x00000000	/* Code Set 0 for 4 bytes code */
#define F_P11     0x30000000	/* Code Set 1 for 4 bytes code */
#define F_P01     0x10000000	/* Code Set 2 for 4 bytes code */
#define F_P10     0x20000000	/* Code Set 3 for 4 bytes code */

/*	
 *	get the process code width 
 */
#define 	__pcw 	(sizeof(_cswidth[1]) > sizeof(unsigned short) || \
		sizeof(_cswidth[2]) > sizeof(unsigned short) || \
		sizeof(_cswidth[3]) > sizeof(unsigned short)) ? \
			sizeof(unsigned long)		      : \
			sizeof(unsigned short)
		

/*	wcsize(wc) and
	_wcsize(wc)	these two macros have been changed to a function.
			because of the added validation code, it is too big
			to be made a macro.
			the two definitions below are for compatibilty with
			AT&T's version.
*/
#define wcsize( wc )	_wcsizefunc( wc )
#define _wcsize( wc )	_wcsizefunc( wc )

#define iswspace(x)	(isascii(x) ? isspace(x) : 0)

#define	controlc(c)	( ((c) & 0x7F) <= 0x20 || ((c) & 0x7F) == 0x7F )

#define	control1(c)	( (c) >= 0x80 && (c) <= 0xA0 || (c) == 0xFF)

#define graphic(c)	( (c) >= 0xA1 && (c) <= 0xFE )

#define _LIBW_PCODE_H_

#endif /* _LIBW_PCODE_H_ */

