/*
 * |-----------------------------------------------------------|
 * | Copyright (c) 1990 MIPS Computer Systems, Inc.            |
 * | All Rights Reserved                                       |
 * |-----------------------------------------------------------|
 * |          Restricted Rights Legend                         |
 * | Use, duplication, or disclosure by the Government is      |
 * | subject to restrictions as set forth in                   |
 * | subparagraph (c)(1)(ii) of the Rights in Technical        |
 * | Data and Computer Software Clause of DFARS 52.227-7013.   |
 * |         MIPS Computer Systems, Inc.                       |
 * |         928 Arques Avenue                                 |
 * |         Sunnyvale, CA 94086                               |
 * |-----------------------------------------------------------|
 */
/* $Header: pcode.h,v 1.1.2.1 92/06/24 13:56:59 marker Exp $ */

/*	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	"@(#)head:pcode.h 1.0 AT&T-UP"

#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 */

/* start for MNLS 3.2 by AT&T UP  Jan.18,1989 */
/*
 *	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
 */
/* SRA_BUG_FIX
#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 	__pcw	(_cswidth[1] > sizeof(unsigned short) ||\
		_cswidth[2] > sizeof(unsigned short) || \
		_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)
/* end for MNLS 3.2 */
