/* $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) 1988 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.	*/

#ident	"$Header: pcode.h 1.3 89/10/31 $@(#)head:pcode.h 1.0 AT&T-UP"

#ifndef _PCODE_H_

#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)


/* #define	wcsize(x)	((x) & EUCMASK) == P00 ? 1 : \		*/
/*			((x) & EUCMASK) == P11 ? _cswidth[1] : \	*/
/*			((x) & EUCMASK) == P10 ? _cswidth[3]+1 : \	*/
/*			iscntrl(x)            ? 1 : _cswidth[2]+1	*/

#define	_wcsize(x)	(((x) & F_EUCMASK) == F_P00 ? 1 : \
			((x) & F_EUCMASK) == F_P11 ? _cswidth[1] : \
			((x) & F_EUCMASK) == F_P10 ? _cswidth[3]+1 : \
			iscntrl(x)            ? 1 : _cswidth[2]+1)
#define	wcsize(x)	( __pcw ) > sizeof(unsigned short) ? \
			_wcsize(x) : \
			(((x) & EUCMASK) == P00 ? 1 : \
			((x) & EUCMASK) == P11 ? _cswidth[1] : \
			((x) & EUCMASK) == P10 ? _cswidth[3]+1 : \
			iscntrl(x)            ? 1 : _cswidth[2]+1)
#define _PCODE_H_
#endif  /* _PCODE_H_ */
