/****
 *
 * Copyright (c) 1988 by Sun Microsystems, Inc.
 * @(#)sh_error.h 22.1 89/08/10 Copyright 1988 Sun Micro
 *
 * SH_ERROR.H - Shapes error codes and macros
 *
 ****/
#ifndef	_SH_ERROR

/*
 * External Error Info
 */
extern	Unsgn8	sh_err_no;	/* internal error code */
extern	char	*sh_err_msg;	/* internal error string */
extern	void	sh_error_int();	/* issue internal error */
extern	void	sh_fatal_int();	/* issue fatal internal error */
extern	void	sh_error_ctx();	/* issue context error */
extern	void	sh_fatal_ctx();	/* issue fatal context error */

/*
 * Internal Error handling macros
 *
 * Clear_Error()		Clear internal error code
 * Clear_Context_Error(ctx)	Clear error code of context
 * Error_Internal(err, msg)	Issue internal error
 * Error_Context(ctx, err, msg)	Issue context error
 * Set_Context_Error(ctx)	Set context error from internal error
 *
 */
#define	Clear_Error()		(sh_err_no = 0)
#define	Clear_Context_Error(c)	((c)->CTX_ERROR = 0)
#define	Set_Context_Error(c)	((c)->CTX_ERROR = sh_err_no)

#ifdef	DEBUG

#define Error_Context(c, n, m)	(sh_error_int(n, m), sh_error_ctx(c, n, m))
#define Fatal_Context(c, n, m)	(sh_fatal_int(n, m), sh_fatal_ctx(c, n, m))
#define Error_Internal(n, m)	sh_error_int(n, m)
#define Fatal_Internal(n, m)	sh_fatal_int(n, m)

#else	/* DEBUG */

#define Error_Context(c, n, m)	(sh_error_int(n, ""), sh_error_ctx(c, n, ""))
#define Fatal_Context(c, n, m)	(sh_fatal_int(n, ""), sh_fatal_ctx(c, n, ""))
#define Error_Internal(n, m)	sh_error_int(n, "")
#define Fatal_Internal(n, m)	sh_fatal_int(n, "")

#endif	/* DEBUG */

#define		SH_MEM_COLS_BAD_SHAPE		1
		/* COLOR_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_CPS_BAD_SHAPE		2
		/* COPY_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_CPGLY_BAD_DEPTH		3
		/* COPY_GLYPH: Unsupported raster depth combination. */
#define		SH_MEM_GLYS_BAD_SHAPE		4
		/* GLYPH_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_GLYS_BAD_DEPTH		5
		/* GLYPH_SHAPE: Unsupported raster depth combination.*/
#define		SH_MEM_TEXS_NULL_FILL_RAS	6
		/* TEXTURE_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_TEXS_BAD_SHAPE		7
		/* TEXTURE_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_TEXS_RAS_UNUSABLE	8
 	    /* TEXTURE_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_MEM_TEXS_BAD_DEPTH		9
 		/* TEXTURE_SHAPE: Unsupported raster depth combination. */
#define		SH_MEM_STPLS_NULL_FILL_RAS	10
		/* STIPPLE_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_STPLS_BAD_SHAPE		11
		/* STIPPLE_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_STPLS_RAS_UNUSABLE	12
 	    /* STIPPLE_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_MEM_STPLS_BAD_DEPTH		13
 		/* STIPPLE_SHAPE: Unsupported raster depth combination. */
#define		SH_OBJ_MAX_CLASS		14
		/* +Too many classes, cannot create new one. */
#define		SH_OBJ_CLASS_ATTR		15
		/* +Illegal class attribute. */
#define		SH_OBJ_NO_MEM			16
		/* +Allocation failed, no more memory." */
#define		SH_OBJ_SET_CLASS		17
		/* New class objects larger than current one. */
#define		SH_OBJ_BAD_DISPATCH		18
		/* Object dispatch table botched. */
#define		SH_BASIS_NO_SURF		19
		/* Surfaces not supported yet. */
#define		SH_BASIS_NO_BSPLINE		20
		/* B-Splines not supported yet. */
#define		SH_BASIS_MAX_ORDER		21
		/* Value exceeds maximum curve order. */
#define		SH_BASIS_COPY			22
		/* Destination BASIS not large enough. */
#define		SH_BASIS_PNT_TYPE		23
		/* Illegal control point type. */
#define		SH_BASIS_TRANS			24
		/* Cannot create basis transform. */
#define		SH_BASIS_ATTR			25
		/* Illegal basis attribute. */
#define		SH_CMAP_ATTR			26
		/* +Illegal color map attribute. */
#define		SH_CMAP_DIRECT			27
		/* +Direct color not allowed with color map. */
#define		SH_CMAP_CREATE			28
		/* +Cannot create color map. */
#define		SH_CMAP_RGB			29
		/* +Color function must return RGB color. */
#define		SH_CMAP_SIZE			30
		/* +Cannot change color map size. */
#define		SH_CMAP_COL_INPUT		31
		/* +Illegal color input type. */
#define		SH_CMAP_COL_OUTPUT		32
		/* Illegal color output type. */
#define		SH_CMAP_TOO_BIG			33
		/* +CMAP_SIZE + CMAP_OFFSET too large. */
#define		SH_PAT_CREATE			34
		/* Cannot create pattern. */
#define		SH_PAT_BAD_TYPE			35
		/* Illegal pattern type. */
#define		SH_PAT_ATTR			36
		/* Illegal pattern attribute. */
#define		SH_PAT_CONVERT			37
		/* Could not change pattern type. */
#define		SH_LIGHT_CREATE			38
		/* Cannot create light group. */
#define		SH_LIGHTS_ADD			39
		/* Cannot add to light group. */
#define		SH_LIGHT_GET			40
		/* Cannot get light source. */
#define		SH_LIGHT_SET			41
		/* Cannot get light source. */
#define		SH_LIGHT_COPY			42
		/* Destination light group too small. */
#define		SH_CTX_CREATE			43
		/* Cannot create context. */
#define		SH_CTX_TEMP			44
		/* Cannot create temporaries. */
#define		SH_CURVE_MISSING		45
		/* Missing curve control points. */
#define		SH_NO_MEM			46
		/* Out of memory. */
#define		SH_RND_PAT_VEC_FILL_SHAPE	47
		/* Left and right Y don't match. */
#define		SH_TRANS_CREATE			48
		/* Cannot create transform. */
#define		SH_TRANS_INV			49
		/* +Cannot compute inverse. */
#define		SH_PNT_TYPE			50
		/* +Illegal point type. */
#define		SH_PATH_AREA_CUR		51
		/* +Cannot apply area operators to current path. */
#define		SH_PATH_FILE_OPEN		52
		/* +Cannot open file. */
#define		SH_PATH_READ_SIZE		53
		/* +Illegal path size in file. */
#define		SH_PATH_READ_EOF		54
		/* +Cannot read all data from file. */
#define		SH_PATH_WRITE_EMPTY		55
		/* +Cannot write empty path. */
#define		SH_PATH_WRITE_ERR		56
		/* +Error writing file. */
#define		SH_CTX_PATH_ATTACH		57
		/* +CTX_PATH not a PATH object. */
#define		SH_CTX_PATH_USED		58
		/* +Path already in use by another CONTEXT. */
#define		SH_PATH_NO_AREA			59
		/* +Area operator applied to path with no area. */
#define		SH_GLYPH_DIM			60
		/* Bad dimensions for glyph. */
#define		SH_GLYPH_CREATE			61
		/* Cannot create glyph. */
#define		SH_GLYPH_ATTR			62
		/* Illegal glyph attribute. */
#define		SH_SHAPE_CREATE			63
		/* Cannot create shape. */
#define		SH_SHAPE_CLOSE			64
		/* Shape too large. */
#define		SH_SHAPE_XORDER			65
		/* X lists out of order */
#define		SH_SHAPE_YORDER			66
		/* Y lists out of order. */
#define		SH_RAS_BAD_PARENT		67
		/* Parent of child raster is invalid. */
#define		SH_RAS_BAD_PAR_DEPTH		68
		/* Parent of child raster has invalid depth. */
#define		SH_RAS_BAD_PAR_CMAP		69
		/* Parent of child raster has no color map. */
#define		SH_RAS_BAD_PAR_DIM		70
		/* Parent of child raster has invalid dimensions. */
#define		SH_RAS_PAR_BAD_TYPE		71
		/* Greatest ancestor of child raster has unacceptable type. */
#define		SH_RAS_CREATE			72
		/* Cannot create raster. */
#define		SH_RAS_CMAP			73
		/* CMAP does not belong to this raster. */
#define		SH_RAS_DIM			74
		/* Bad dimensions for raster. */
#define		SH_RAS_CTX			75
		/* Context argument not CONTEXT object. */
#define		SH_RAS_BAD_DISP			76
		/* Illegal raster display operation. */
#define		SH_RAS_BAD_STORE		77
		/* Illegal raster store operation. */
#define		SH_CTX_RAS			78
		/* +CTX_RASTER must be non-null. */
#define		SH_CMAP_INIT			79
		/* +Raster depth unspecified. */
#define		SH_RAS_ATTR			80
		/* Illegal raster attribute. */
#define		SH_RAS_DEPTH			81
		/* Illegal raster depth. */
#define		SH_RAS_UNS_COMB			82
		/* Unsupported raster depth combination. */
#define		SH_LIGHTS_MAX			83
                /* Value exceeds maximum light sources. */
#define		SH_TRANS_AXIS			84
		/* +Illegal rotation axis. */
#define		SH_CTX_ATTR			85
		/* +Illegal context attribute. */
#define		SH_CTX_ROP			86
		/* +Illegal CTX_ROP value. */
#define		SH_CTX_MODEL_TRANS		87
		/* CTX_MODEL_TRANSFORM not a TRANSFORM object. */
#define		SH_CTX_VIEW_TRANS		88
		/* CTX_VIEW_TRANSFORM not a TRANSFORM object. */
#define		SH_CTX_VDC_TRANS		89
		/* CTX_VDC_TRANSFORM not a TRANSFORM object. */
#define		SH_CTX_CLIP			90
		/* +CTX_CLIP_PATH not a PATH object. */
#define		SH_CTX_BASIS			91
		/* CTX_BASIS not a BASIS object. */
#define		SH_CTX_LIGHTS			92
		/* +CTX_LIGHTS not a LIGHTS object. */
#define		SH_RND_EDGETAB			93
		/* Cannot enlarge edge table. */
#define		SH_RND_BAD_PATH			94
		/* Illegal path item. */
#define		SH_RAS_INIT_FB_COUNT		95
		/* Init_Raster: Too many frame buffers open. */
#define		SH_RAS_INIT_NULL_FB_NAME	96
		/* Init_Raster: NULL frame buffer name. */
#define		SH_RAS_INIT_FB_NAME_LENGTH	97
		/* Init_Raster: Frame buffer name too long. */
#define		SH_RAS_INIT_CMAP_CREATE		98
		/* Init_Raster: Cannot create color map. */
#define		SH_RAS_INIT_MMAP		99
		/* + mmap_fb: Frame buffer valloc failed. */
#define		SH_RAS_FB_OPEN_DEV		100
		/* sunfb_open: Unable to open device. */
#define		SH_RAS_FB_OPEN_ATTR		101
		/* sunfb_open: Problem determining FBIOGTYPE. */
#define		SH_RAS_FB_OPEN_TYPE		102
		/* sunfb_open: Unrecognized frame buffer type. */
#define		SH_TRANS_EMPTY			103
		/* gp_matrix_find: active list empty. */
#define		SH_TRANS_ATTR			104
		/* +Get_Transform: Illegal transform attribute. */
#define		SH_CTX_DESTROY			105
		/* Destroy_Context: Can't destroy view. */
#define		SH_CG2_FLGL_BAD_DEPTH		106
		/* FILL_GLYPH: Unsupported raster depth combination. */
#define		SH_CG2_FLGLS_BAD_DEPTH		107
		/* FILL_GLYPH_SHAPE: Unsupported raster depth combination. */
#define		SH_MEM_STGLY_BAD_DEPTH		108
		/* STIPPLE_GLYPH: Unsupported raster depth combination. */
#define		SH_MEM_STGLYS_BAD_SHAPE		109
		/* STIPPLE_GLYPH_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_STGLYS_BAD_DEPTH		110
		/* STIPPLE_GLYPH_SHAPE: Unsupported raster depth combination.*/
#define		SH_CG2_STGL_BAD_DEPTH		111
		/* STIPPLE_GLYPH: Unsupported raster depth combination. */
#define		SH_CG2_STGLS_BAD_SHAPE		112
		/* STIPPLE_GLYPH_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_STGLS_BAD_DEPTH		113
		/* STIPPLE_GLYPH_SHAPE: Unsupported raster depth combination.*/
#define		SH_CTX_PATH_PEN			114
		/* +Cannot get path pen, path empty or non-existent. */
#define		SH_RAS_INIT_EXT			115
		/* Init_Raster: Cannot Extend cg6 raster */
#define		SH_MEM_STGLY_NULL_FILL_RAS	116
		/* STIPPLE_GLYPH: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_STGLY_RAS_UNUSABLE	117
 	    /* STIPPLE_GLYPH: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_STGL_NULL_FILL_RAS	118
		/* STIPPLE_GLYPH: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_STGL_RAS_UNUSABLE	119
 	    /* STIPPLE_GLYPH: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_MEM_STGLYS_NULL_FILL_RAS	120
		/* STIPPLE_GLYPH_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_STGLYS_RAS_UNUSABLE	121
     /* STIPPLE_GLYPH_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_STGLS_NULL_FILL_RAS	122
		/* STIPPLE_GLYPH_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_STGLS_RAS_UNUSABLE	123
     /* STIPPLE_GLYPH_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_MEM_TEXGLY_BAD_DEPTH		124
		/* TEXTURE_GLYPH: Unsupported raster depth combination.*/
#define		SH_MEM_TEXGLY_NULL_FILL_RAS	125
		/* TEXTURE_GLYPH: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_TEXGLY_RAS_UNUSABLE	126
 	    /* TEXTURE_GLYPH: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_TXGL_BAD_DEPTH		127
		/* TEXTURE_GLYPH: Unsupported raster depth combination.*/
#define		SH_CG2_TXGL_NULL_FILL_RAS	128
		/* TEXTURE_GLYPH: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_TXGL_RAS_UNUSABLE	129
 	    /* TEXTURE_GLYPH: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_MEM_TEXGLYS_BAD_SHAPE	130
		/* TEXTURE_GLYPH_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_TEXGLYS_BAD_DEPTH	130
		/* TEXTURE_GLYPH_SHAPE: Unsupported raster depth combination.*/
#define		SH_MEM_TEXGLYS_NULL_FILL_RAS	131
		/* TEXTURE_GLYPH_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_TEXGLYS_RAS_UNUSABLE	132
     /* TEXTURE_GLYPH_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_TXGLS_BAD_SHAPE		133
		/* TEXTURE_GLYPH_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_TXGLS_BAD_DEPTH		134
		/* TEXTURE_GLYPH_SHAPE: Unsupported raster depth combination.*/
#define		SH_CG2_TXGLS_NULL_FILL_RAS	135
		/* TEXTURE_GLYPH_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_TXGLS_RAS_UNUSABLE	136
     /* TEXTURE_GLYPH_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG6_FBC_EXCEPTION		137
     		/* Unexpected cg6 fbc exception in lowest level pixel func */
#define         SH_CMAP_ROOT                    138
                /* +Init_Cmap: Root must be CMAP or RASTER */
#define		SH_CG2_FLGLS_BAD_SHAPE		139
		/* FILL_GLYPH_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_CPS_BAD_DEPTH		140
 		/* COPY_SHAPE: Unsupported raster depth combination. */
#define		SH_MEM_FLS_BAD_SHAPE		141
		/* FILL_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_FLS_BAD_DEPTH		142
 		/* FILL_SHAPE: Unsupported raster depth combination. */
#define		SH_MEM_OPSS_NULL_FILL_RAS	143
		/* OPSTIPPLE_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_MEM_OPSS_BAD_SHAPE		144
		/* OPSTIPPLE_SHAPE: Shape exceeds raster boundaries. */
#define		SH_MEM_OPSS_RAS_UNUSABLE	145
 	  /* OPSTIPPLE_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_MEM_OPSS_BAD_DEPTH		146
 		/* OPSTIPPLE_SHAPE: Unsupported raster depth combination. */
#define		SH_CG2_FLS_BAD_SHAPE		147
		/* FILL_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_CPS_BAD_SHAPE		148
		/* COPY_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_CPS_BAD_DEPTH		149
 		/* COPY_SHAPE: Unsupported raster depth combination. */
#define		SH_CG2_TEXS_NULL_FILL_RAS	150
		/* TEXTURE_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_TEXS_BAD_SHAPE		151
		/* TEXTURE_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_TEXS_RAS_UNUSABLE	152
 	    /* TEXTURE_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_TEXS_BAD_DEPTH		153
 		/* TEXTURE_SHAPE: Unsupported raster depth combination. */
#define		SH_CG2_OPSS_NULL_FILL_RAS	154
		/* OPSTIPPLE_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_OPSS_BAD_SHAPE		155
		/* OPSTIPPLE_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_OPSS_RAS_UNUSABLE	156
 	  /* OPSTIPPLE_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_OPSS_BAD_DEPTH		157
 		/* OPSTIPPLE_SHAPE: Unsupported raster depth combination. */
#define		SH_CG2_STPLS_NULL_FILL_RAS	158
		/* STIPPLE_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG2_STPLS_BAD_SHAPE		159
		/* STIPPLE_SHAPE: Shape exceeds raster boundaries. */
#define		SH_CG2_STPLS_RAS_UNUSABLE	160
 	    /* STIPPLE_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG2_STPLS_BAD_DEPTH		161
 		/* STIPPLE_SHAPE: Unsupported raster depth combination. */
#define		SH_CG6_STGLS_NULL_FILL_RAS	162
		/* STIPPLE_GLYPH_SHAPE: Context CTX_FILL_RASTER is NULL. */
#define		SH_CG6_STGLS_RAS_UNUSABLE	163
     /* STIPPLE_GLYPH_SHAPE: No readable portion of CTX_FILL_RASTER exists. */
#define		SH_CG6_STGLS_BAD_DEPTH		164
 		/* STIPPLE_GLYPH_SHAPE: Unsupported raster depth combination. */
#define		SH_CG6_BAD_NORMALIZE_XFORM	165
		/* Validate: Cannot create normalizing transform. */
#define		SH_CG6_INV_CLIP_PT_TYPE		166
		/* Validate: Invalid clip region point type */
#define		SH_CURS_ATTR			167
		/* Get_Cursor: Illegal cursor attribute. */
#define		SH_CURS_RASTER			168
		/* Set_Cursor: Cursor raster is not a screen raster. */
#define		SH_CURS_COLOR			169
		/* Set_Cursor:Cursor has no screen raster associated with it */
#define		SH_CURS_RAS_CMAP		170
		/* Set_Cursor: Cursor raster has no color map. */
#define		SH_CURS_COLOR_TYPE		171
		/* Set_Cursor: Unsupported cursor color type. */
#define		SH_CURS_IMAGE_RASTER		172
		/* Set_Cursor: Image Raster pixel depth not equal to 1. */
#define		SH_CURS_MASK_RASTER		173
		/* Set_Cursor: Mask Raster pixel depth not equal to 1. */
#define		SH_CURS_INIT_RAS		174
		/* +Set_Cursor: Missing CURS_IMAGE_RASTER or CURS_MASK_RASTER.*/
#define		SH_CURS_INIT_BACK_RAS		175
		/* +Set_Cursor: Can't create backing raster. */
#define		SH_CURS_RND_RASTER		176
		/* +Render_Cursor:Cursor not associated with a screen raster. */
#define		SH_CURS_RND_IMAGE		177
		/* +Render_Cursor:Missing CURS_IMAGE_RASTER or CURS_MASK_RASTER*/
#define		SH_CLASS_TYPE_MAX		178
		/* +NewType_Class: cannot allocate new class type. */
#define		SH_CMAP_WRITE_BAD_CREATE	179
		/* Write_Cmap: Cannot create color map. */
#define		SH_CMAP_WRITE_UNKNOWN_FORMAT	180
		/* Write_Cmap: Unsupported data format. */
#define		SH_CMAP_READ_UNKNOWN_FORMAT	181
		/* Read_Cmap: Unsupported data format. */
#define		SH_CG6_EXCEPTION		182
		/* Render/Transform path: TEC exception occurs. */
#define		SH_TRANS_TRANSPOSE		183
		/* +Cannot compute transpose. */  


#define	_SH_ERROR
#endif	/* _SH_ERROR */
