/****
 *
 * Copyright (c) 1988 by Sun Microsystems, Inc.
 * @(#)sh_CTX.h 22.1 89/08/10 Copyright 1988 Sun Micro
 *
 * CTX.H CONTEXT object information
 * 
 ****/
#ifndef	_CLASS_CTX

/*
 * Context attributes.
 */
typedef enum
  {
   CTX_TYPE,		/* context type (internal) */
   CTX_RASTER,		/* raster handle */
   CTX_COLOR,		/* current color */
   CTX_BACK_COLOR,	/* background color */
   CTX_ROP,		/* current raster-op */
   CTX_PLANE_ENABLE,	/* plane enable mask */
   CTX_SHADE,		/* shading */
   CTX_AREA_STYLE,	/* area closure/fill */
   CTX_LINE_STYLE,	/* solid, dashed or double dashed */
   CTX_LINE_PATTERN,	/* index of texture pattern for lines */
   CTX_LINE_SIZE,	/* size of brush for lines */
   CTX_LINE_SIZE_FRACT,
   CTX_MITER_LIMIT,     /* miter limit if line join is mitered */
   CTX_MITER_LIMIT_FRACT,
   CTX_FILL_STYLE,	/* polygon/area fill style */
   CTX_FILL_RASTER,	/* texturing/stippling raster for area fill */
   CTX_FILL_ORG,	/* texture/stipple reference origin */
   CTX_LINE_CAP,        /* line cap */
   CTX_LINE_JOIN,       /* line join */
   CTX_PIPELINE,	/* graphics pipeline options */
   CTX_PATH,		/* path */
   CTX_CLIP_PATH,	/* clip path */
   CTX_EMPTY,		/* context empty flag */
   CTX_FLATNESS,	/* flatness for Flatten_Path */
   CTX_VIEW_TRANSFORM,	/* view transform */
   CTX_MODEL_TRANSFORM,	/* model transform */
   CTX_VDC_TRANSFORM,	/* VDC transform */
   CTX_VDC_MAP,		/* VDC mapping characteristics */
   CTX_CLIP_ORG,	/* clip area origin */
   CTX_CLIP_DIM,	/* clip area dimensions */
   CTX_CLIP_PLANES,	/* clipping planes */
   CTX_HIDDEN_SURF,	/* Z buffering */
   CTX_LIGHT,		/* light source positions */
   CTX_SPEC_POWER,	/* specular power */
   CTX_DIFFUSE,		/* diffuse reflection */
   CTX_SPECULAR,	/* specular reflection */
   CTX_AMBIENT,		/* ambient light */
   CTX_TRANSPARENCY,	/* transparency */
   CTX_PICK_ORG,	/* origin of pick area (pixels) */
   CTX_PICK_DIM,	/* dimensions of pick area (pixels) */
   CTX_PICK_COUNT,	/* pick count */
/*
 * inquired via subroutine
 */
   CTX_PICK_ID,		/* pick identifier */
   CTX_ERROR,		/* last error message */
   CTX_PEN,		/* last point rendered (user coords) */
   CTX_RASTER_PEN,	/* last point rendered (raster coords) */
   CTX_PATH_PEN,	/* last point in path (user coords) */
   CTX_PATH_RASTER_PEN,	/* last point in path (raster coords) */
  } CTX_attr;

#define	CTX_ATTRS	((int) CTX_ERROR)

/*
 * Display_Context argument
 */
#define	CTX_RENDER		1
#define	CTX_FLUSH		2
#define	CTX_RENDER_FLUSH	3

/*
 * CONTEXT type values (only one type right now)
 * CONTEXT status values (CTX_EMPTY only)
 */
#define	CTX_GENERIC	0	/* generic type */
#define	CTX_3D		1	/* generic type, 3D enabled */

#define	CTX_EMPTY	1	/* path empty status */

typedef	Sgn32	CTX_pick_id;

/*
 * CTX_SHADE attribute values
 */
typedef Unsgn8 CTX_shade;

#define	CTX_SHADE_OFF 		0	/* outline */
#define	CTX_SHADE_DEPTH		1	/* outline, depth cued */
#define	CTX_SHADE_SOLID		2	/* shade with solid color */
#define	CTX_SHADE_POLYGON	3	/* apply shade to whole polygon */
#define	CTX_SHADE_VERTEX	4	/* apply shade at each vertex */
#define	CTX_SHADE_PIXEL		5	/* apply shade at each pixel */
#define	CTX_SHADE_GOURAUD	6	/* Gouraud shading, use vertex colors*/

#define	CTX_SHADE_HOLLOW CTX_SHADE_OFF

/*
 * CTX_ROP attribute values
 *
 * WARNING: The values used to initialize members of the CTX_rop
 * enumeration must not be changed (contact Ken). 
 *
 * NAMING CONVENTION: In the enum members below, the suffix "INVERTED"
 * means the complement of the source is used, while "REVERSED" means the
 * destination is complemented before it is used. These conventions are
 * taken from the X11 ROPs and do not necessarily reflect the views of
 * the implementor. The logical function names are derived from the
 * Shapes specification i.e. Paint == OR,Draw == Copy,Erase == And destination
 * with complement of source, etc. When Shapes does not specify a name the
 * standard logical operation mnemonic is used e.g. NAND.
 */

#define	CTX_ROP_SRC	(0x0C)		/* context source pixel op code */
#define CTX_ROP_DST	(0x0A)		/* context destination pixel op code */
#define CTX_ROP_NOT(c)	((0x0F)&~(c))	/* ~ and clear extraneous upper bits */
#define CTX_ROP_MASK	((Unsgn32)0x0F)	/* all rops 0 <= ROP <= 15 */

typedef Unsgn8	CTX_rop;

#define CTX_ROP_CLEAR 			0
#define CTX_ROP_NOR			CTX_ROP_NOT(CTX_ROP_SRC | CTX_ROP_DST)
#define CTX_ROP_ERASE			CTX_ROP_NOT(CTX_ROP_SRC) & CTX_ROP_DST
#define CTX_ROP_DRAW_INVERTED		CTX_ROP_NOT(CTX_ROP_SRC)
#define CTX_ROP_ERASE_REVERSED		CTX_ROP_SRC & CTX_ROP_NOT(CTX_ROP_DST)
#define CTX_ROP_INVERT			CTX_ROP_NOT(CTX_ROP_DST)
#define CTX_ROP_XOR			CTX_ROP_SRC ^ CTX_ROP_DST
#define CTX_ROP_NAND			CTX_ROP_NOT(CTX_ROP_SRC & CTX_ROP_DST)
#define CTX_ROP_AND			CTX_ROP_SRC & CTX_ROP_DST
#define CTX_ROP_EQUIVALENT		CTX_ROP_NOT(CTX_ROP_SRC) ^ CTX_ROP_DST
#define CTX_ROP_NO_OP			CTX_ROP_DST
#define CTX_ROP_PAINT_INVERTED		CTX_ROP_NOT(CTX_ROP_SRC) | CTX_ROP_DST
#define CTX_ROP_DRAW			CTX_ROP_SRC	
#define CTX_ROP_PAINT_REVERSED		CTX_ROP_SRC | CTX_ROP_NOT(CTX_ROP_DST)
#define CTX_ROP_PAINT			CTX_ROP_SRC | CTX_ROP_DST	
#define CTX_ROP_SET			CTX_ROP_NOT(0) 

typedef	Unsgn32	CTX_plane_enable;

/*
 * CTX_VDC_MAP attribute values
 */
typedef Unsgn8 CTX_vdc_map;

#define	CTX_MAP_OFF		0	/* Use VDC transform */
#define CTX_MAP_ALL		1	/* auto scale both X and Y */
#define CTX_MAP_ASPECT		2	/* auto scale to aspect ratio */
#define CTX_MAP_RASTER		3	/* VDC = raster space */

/*
 * CTX_AREA_STYLE attribute values
 */
typedef Unsgn8 CTX_area_style;

#define	CTX_CLOSE_OFF		0	/* close polygon only explicitly */
#define	CTX_CLOSE_MOVE		1	/* close polygon after Move operation*/
#define CTX_FILL_NONZERO 	0	/* use non-zero winding rule */
#define CTX_FILL_EVENODD 	4	/* use even-odd winding rule */

/*
 * CTX_FILL_STYLE attribute values
 */
typedef Unsgn8 CTX_fill_style;

#define CTX_FILL_SOLID		0	/* fill with solid color */
#define CTX_FILL_TEXTURED	1	/* fill with 2D texture */
#define CTX_FILL_OPAQUE_STIPPLED 2	/* opaque stipple fill (fgnd & bknd) */
#define CTX_FILL_STIPPLED	3	/* stipple fill (fgnd pxls only) */


/*
 * CTX_HIDDEN_SURF attribute values
 */
typedef Unsgn8 CTX_hidden_surf;

#define	CTX_HIDDEN_OFF		0
#define	CTX_HIDDEN_ZBUF		1	/* enable Z buffering */
#define	CTX_HIDDEN_BACK		2	/* reject polygon backfaces */

/*
 * CTX_PIPELINE attribute values
 */
typedef	Unsgn8 CTX_pipeline;

#define	CTX_APPLY_MODEL		1	/* apply model transform */
#define	CTX_APPLY_VIEW		2	/* apply view transform */
#define	CTX_APPLY_VDC		4	/* apply VDC transform */
#define	CTX_APPLY_CLIP		8	/* clip coordinates */
#define CTX_APPLY_RENDER 	16	/* apply at render time */
#define CTX_APPLY_CONSTRUCT 	0   	/* apply at construct time */


/*
 * CTX_CLIP_PLANES attribute values
 * The following may be or-ed together to select the clipping planes
 * The order of the bit is critical, has to consider clipVec3d.c and
 * clip.h before changing anything.
 */
typedef Unsgn8 CTX_clip_planes;

#define	CTX_CLIP_LEFT		0x01
#define	CTX_CLIP_RIGHT		0x02
#define	CTX_CLIP_TOP		0x04
#define	CTX_CLIP_BOTTOM		0x08
#define	CTX_CLIP_YON		0x10
#define	CTX_CLIP_BACK		0x10
#define	CTX_CLIP_HITHER		0x20
#define	CTX_CLIP_FRONT		0x20
#define	CTX_CLIP_X		0x03
#define	CTX_CLIP_Y		0x0C
#define	CTX_CLIP_Z		0x30
#define	CTX_CLIP_ALL		0x3F

/*
 * CTX_LINE_CAP		line cap attribute
 */
typedef Unsgn8	CTX_line_cap;

#define	CTX_CAP_BUTT		0	/* butt cap, this is the default cap */
#define	CTX_CAP_ROUND		1	/* round cap */
#define CTX_CAP_SQUARE		2	/* square cap */
#define	CTX_CAP_NOTLAST		3	/* skip last point for width 0 lines */

/*
 * CTX_LINE_JOIN	line join attribute
 */
typedef Unsgn8 CTX_line_join;

#define CTX_JOIN_MITER		0	/* mitered join, the default join */
#define	CTX_JOIN_ROUND		1	/* round join */
#define	CTX_JOIN_BEVEL		2	/* beveled join */

/*
 * CTX_LINE_STYLE
 */
typedef Unsgn8 CTX_line_style;

#define CTX_LINE_SOLID		0	/* solid lines, pattern ignored */
#define CTX_LINE_DASHED		1	/* dashed lines if pattern present */
#define CTX_LINE_DOUBLE_DASHED	2	/* double dashed if pattern present */

/*
 * Device specific CONTEXT operators.
 * The following operations on CONTEXT objects are device specific.
 * They have different implementations for different devices.
 *
 * Destroy_Context(ctx)		destroy context object
 * Copy_Context(src,dst)	copy context
 * Get_Context(ctx, attr)	get context attribute
 * Set_Context(ctx, attr, val)	set context attribute
 * Clear_Context(ctx)		clear context to background color
 * Display_Context(ctx, how)	render current path
 *
 * Print_Context(ctx)		print context information
 * Extend_Context(ctx)		extend current path of context
 * Winview_Context(ctx)		window to viewport mapping
 * Pipeline_Context(ctx, trans)	pipeline transformation selection
 */
#define	CTX_OP_Destroy	0
#define	CTX_OP_Init	1
#define	CTX_OP_Get	2
#define	CTX_OP_Set_I	3
#define CTX_OP_Set_F	4
#define	CTX_OP_Print	5
#define	CTX_OP_Copy	6
#define	CTX_OP_Extend	7
#define	CTX_OP_Winview	8
#define	CTX_OP_Pipeline	9
#define	CTX_OPERS	10

#define	Create_Context	sh_Create_Context
#define	Temp_Context	sh_Temp_Context

extern	CONTEXT	sh_Create_Context();
extern	CONTEXT	sh_Temp_Context();

#define	Destroy_Context(ctx)	Destroy_Obj(ctx)
#define	Print_Context(ctx)	((void) GetOper_Obj(ctx, CTX_OP_Print)(ctx))
#define	Clear_Context(ctx)	((void) GetOper_Obj((ctx)->CTX_RASTER, \
				RAS_OP_Clear)((ctx)->CTX_RASTER, ctx))
#define Extend_Context(ctx)	((void) GetOper_Obj(ctx, CTX_OP_Extend)(ctx))
#define Winview_Context(ctx)    ((void) GetOper_Obj(ctx,CTX_OP_Winview)(ctx))
#define Pipeline_Context(ctx,t) ((void) GetOper_Obj(ctx,CTX_OP_Pipeline)(ctx,t))
#define	Display_Context(ctx, how) \
	Path_Raster((ctx)->CTX_RASTER, (ctx)->CTX_PATH, ctx, how)
#define	Copy_Context(src,dst) \
	((CONTEXT) GetOper_Obj(src, CTX_OP_Copy)(src,dst))
	
/*
 * CONTEXT object representation
 */
struct class_CTX
  {
#include "sh_CTX.ah"
   Unsgn32	ctx_dd[SH_DD_SLOTS];    /* device dependent info */
  };

/*
 * Get_Context(vp, attr)
 * Fast way to access context attributes.
 * This macro depends on the "attr" argument being a compile time constant.
 */
#ifdef Get_Context
#undef Get_Context
#endif

#ifndef	SH_MONITOR

#define	Get_Context(c,a)	CAT(a,get)((CONTEXT)(c))

#else	/* SH_MONITOR */

#define	Get_Context(c,a)	CAT(a,get)((CONTEXT)(sh_Monitor_Get_Context(c)))

#endif	/* SH_MONITOR */

#define	CTX_RASTERget(v)	((v)->CTX_RASTER)
#define	CTX_SHADEget(v)		((v)->CTX_SHADE)
#define	CTX_BACK_COLORget(v)	(&((v)->CTX_BACK_COLOR))
#define	CTX_COLORget(v)		(&((v)->CTX_COLOR))
#define	CTX_ROPget(v)		((v)->CTX_ROP)
#define	CTX_PLANE_ENABLEget(v)	((v)->CTX_PLANE_ENABLE)
#define	CTX_LINE_STYLEget(v)	((v)->CTX_LINE_STYLE)
#define	CTX_LINE_PATTERNget(v)	((v)->CTX_LINE_PATTERN)
#define	CTX_FLATNESSget(v)	((v)->CTX_FLATNESS)
#define	CTX_LINE_SIZEget(v)	floatfr((v)->CTX_LINE_SIZE)
#define	CTX_LINE_SIZE_FRACTget(v) ((v)->CTX_LINE_SIZE)
#define CTX_MITER_LIMITget(v)	floatfr((v)->CTX_MITER_LIMIT)
#define	CTX_MITER_LIMIT_FRACTget(v) ((v)->CTX_MITER_LIMIT)
#define CTX_LINE_CAPget(v)	((v)->CTX_LINE_CAP)
#define CTX_LINE_JOINget(v)	((v)->CTX_LINE_JOIN)
#define	CTX_PATTERNget(v)	((v)->CTX_PATTERN)
#define CTX_FILL_STYLEget(v)    ((v)->CTX_FILL_STYLE)
#define CTX_FILL_RASTERget(v)   ((v)->CTX_FILL_RASTER)
#define CTX_FILL_ORGget(v)   	(&((v)->CTX_FILL_ORG))
#define	CTX_PATHget(v)		((v)->CTX_PATH)
#define	CTX_CLIP_PATHget(v)	((v)->CTX_CLIP_PATH)
#define	CTX_VIEW_TRANSFORMget(v) ((v)->CTX_VIEW_TRANSFORM)
#define	CTX_PIPELINEget(v)	((v)->CTX_PIPELINE)
#define	CTX_AREA_STYLEget(v)	((v)->CTX_AREA_STYLE)
#define CTX_EMPTYget(v)		((v)->ctx_buf_ptr == (v)->ctx_buf_top)
#define	CTX_ERRORget(v) \
	((int) GetOper_Obj(v, CTX_OP_Get)(v,CTX_ERROR))
#define	CTX_PATH_RASTER_PENget(v) \
	((POINT *) GetOper_Obj(v, CTX_OP_Get)(v,CTX_PATH_RASTER_PEN))
#define	CTX_PATH_PENget(v) \
	((POINT *) GetOper_Obj(v, CTX_OP_Get)(v,CTX_PATH_PEN))
#define	CTX_PENget(v) \
	((POINT *) GetOper_Obj(v, CTX_OP_Get)(v,CTX_PEN))
#define	CTX_RASTER_PENget(v) \
	((POINT *) GetOper_Obj(v, CTX_OP_Get)(v,CTX_RASTER_PEN))

/* not in SH_SMALL */
#ifdef	SH_SMALL
#define	CTX_MODEL_TRANSFORMget(v)
#define	CTX_VDC_TRANSFORMget(v)
#define	CTX_VDC_MAPget(v)
#define	CTX_CLIP_ORGget(v)
#define	CTX_CLIP_DIMget(v)
#define	CTX_PICK_COUNTget(v)
#define	CTX_PICK_ORGget(v)
#define	CTX_PICK_DIMget(v)
#define	CTX_CLIP_PLANESget(v)
#define	CTX_HIDDEN_SURFget(v)
#define	CTX_LIGHTget(v)
#define	CTX_TRANSPARENCYget(v)
#define	CTX_DIFFUSEget(v)
#define	CTX_SPECULARget(v)
#define	CTX_SPEC_POWERget(v)
#define	CTX_AMBIENTget(v)
#define	CTX_PICK_IDget(v)

#else	/* SH_SMALL */
#define	CTX_MODEL_TRANSFORMget(v) ((v)->CTX_MODEL_TRANSFORM)
#define	CTX_VDC_TRANSFORMget(v)  ((v)->CTX_VDC_TRANSFORM)
#define	CTX_VDC_MAPget(v)	((v)->CTX_VDC_MAP)
#define	CTX_CLIP_ORGget(v)	(&((v)->CTX_CLIP_ORG))
#define	CTX_CLIP_DIMget(v)	(&((v)->CTX_CLIP_DIM))
#define	CTX_PICK_COUNTget(v)	((v)->CTX_PICK_COUNT)
#define	CTX_PICK_ORGget(v)	(&((v)->CTX_PICK_ORG))
#define	CTX_PICK_DIMget(v)	(&((v)->CTX_PICK_DIM))
#define	CTX_CLIP_PLANESget(v)	((v)->CTX_CLIP_PLANES)
#define	CTX_HIDDEN_SURFget(v)	((v)->CTX_HIDDEN_SURF)
#define	CTX_LIGHTget(v)		((v)->CTX_LIGHT)
#define	CTX_TRANSPARENCYget(v)	((v)->CTX_TRANSPARENCY)
#define	CTX_DIFFUSEget(v)	((v)->CTX_DIFFUSE)
#define	CTX_SPECULARget(v)	((v)->CTX_SPECULAR)
#define	CTX_SPEC_POWERget(v)	((v)->CTX_SPEC_POWER)
#define	CTX_AMBIENTget(v)	((v)->CTX_AMBIENT)
#define	CTX_PICK_IDget(v) \
	((CTX_pick_id) GetOper_Obj(v, CTX_OP_Get)(v,CTX_PICK_ID))
#endif	/* SH_SMALL */

/*
 * Set_Context(vp, attr, val)
 * 
 */
#define CTX_CALL_SET_I(c,a,v)	GetOper_Obj(c, CTX_OP_Set_I)(c,a,v)
#define CTX_CALL_SET_F(c,a,v)	GetOper_Obj(c, CTX_OP_Set_F)(c,a,v)

#ifdef NO_COL_DIR
#define CTX_CHK_N_SET_col(c,a,v) do {					\
	COLOR *new = v;							\
	if (Get_Col_Index(Get_Context(c,a)) != Get_Col_Index(new))	\
	   CTX_CALL_SET_I(c,a,new);					\
	} while (0)

#else	/* NO_COL_DIR */
#define CTX_CHK_N_SET_col(c,a,v)	CTX_CALL_SET_I(c,a,v)
#endif	/* NO_COL_DIR */
				    
#define CTX_CHK_N_SET_pt(c,a,v)	do {POINT *old, *new;		\
	old = (POINT *)Get_Context(c,a);  new = (POINT *)v;	\
	if ((Point_Type(old) != PT_BIN2D) ||			\
	    (Point_Type(new) != PT_BIN2D) ||			\
	    !((new->b.x == old->b.x) && (new->b.y == old->b.y))) \
	   CTX_CALL_SET_I(c,a,new);				\
	} while (0)
				    
#define CTX_CHK_N_SET_ptb2d(c,a,v)	do {POINT_B2D *old, *new;	\
	old = (POINT_B2D *)Get_Context(c,a);  new = (POINT_B2D *)v;	\
	if ((Point_Type(old) != PT_BIN2D) ||			\
	    (Point_Type(new) != PT_BIN2D) ||			\
	    !((new->x == old->x) && (new->y == old->y))) 	\
	   CTX_CALL_SET_I(c,a,new);				\
	} while (0)
	
#define CTX_CHK_N_SET_P(c,a,v) \
	((char *) Get_Context(c,a) != (char *) v) ? CTX_CALL_SET_I(c,a,v) : 0

#define CTX_CHK_N_SET_I(c,a,v) \
	(Get_Context(c,a) != v) ? CTX_CALL_SET_I(c,a,v) : 0

#define CTX_CHK_N_SET_F(c,a,v) \
	(Get_Context(c,a) != v) ? CTX_CALL_SET_F(c,a,v) : 0

#ifdef Set_Context
#undef Set_Context
#endif

#ifndef	SH_MONITOR

#define	Set_Context(c,a,v)		CAT(a,set)(c,a,v)

#else	/* SH_MONITOR */

#define	Set_Context(c,a,v)		CAT(a,set)((CONTEXT)sh_Monitor_Set_Context(c),a,v)

#endif	/* SH_MONITOR */

#define	CTX_RASTERset(a,b,c)		CTX_CHK_N_SET_P(a,b,c)
#define CTX_TYPEset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_SHADEset(a,b,c)		CTX_CHK_N_SET_I(a,b,c)
#define	CTX_BACK_COLORset(a,b,c)	CTX_CHK_N_SET_col(a,b,c)
#define	CTX_COLORset(a,b,c)		CTX_CHK_N_SET_col(a,b,c)
#define	CTX_ROPset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_PLANE_ENABLEset(a,b,c)	CTX_CALL_SET_I(a,b,c)
#define	CTX_LINE_STYLEset(a,b,c)	CTX_CHK_N_SET_I(a,b,c)
#define	CTX_LINE_PATTERNset(a,b,c)	CTX_CALL_SET_I(a,b,c)
#define	CTX_LINE_SIZEset(a,b,c)		CTX_CALL_SET_I(a,b,fractf(c))
#define	CTX_LINE_SIZE_FRACTset(a,b,c) \
	(Get_Context(a,b) != c) ? CTX_CALL_SET_I(a,CTX_LINE_SIZE,c) : 0
#define CTX_LINE_CAPset(a,b,c)		((a)->b = (c))
#define CTX_LINE_JOINset(a,b,c)		((a)->b = (c))
#define	CTX_FLATNESSset(a,b,c)		((a)->b = (c))
#define CTX_MITER_LIMITset(a,b,c)	CTX_CALL_SET_I(a,b,fractf(c))
#define CTX_MITER_LIMIT_FRACTset(a,b,c) \
	(Get_Context(a,b) != c) ? CTX_CALL_SET_I(a,CTX_MITER_LIMIT,c) : 0
#define	CTX_PATTERNset(a,b,c)		CTX_CHK_N_SET_P(a,b,c)
#define	CTX_PATHset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_CLIP_PATHset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_VIEW_TRANSFORMset(a,b,c)  	CTX_CALL_SET_I(a,b,c)
#define	CTX_AREA_STYLEset(a,b,c)	CTX_CHK_N_SET_I(a,b,c)
#define CTX_FILL_STYLEset(a,b,c)    	CTX_CALL_SET_I(a,b,c)
#define CTX_FILL_RASTERset(a,b,c)   	CTX_CHK_N_SET_P(a,b,c)
#define CTX_FILL_ORGset(a,b,c)   	CTX_CHK_N_SET_ptb2d(a,b,c)
#define	CTX_PATH_RASTER_PENset(a,b,c) 	CTX_CALL_SET_I(a,b,c)
#define	CTX_PATH_PENset(a,b,c) 		CTX_CALL_SET_I(a,b,c)
#define	CTX_PENset(a,b,c) 		CTX_CALL_SET_I(a,b,c)
#define	CTX_RASTER_PENset(a,b,c) 	CTX_CALL_SET_I(a,b,c)
#define	CTX_PIPELINEset(a,b,c)		CTX_CHK_N_SET_I(a,b,c)
#define CTX_EMPTYset(a,b,c) \
	(Set_Path((a)->CTX_PATH, path_mark, 0), \
	 (a)->ctx_buf_ptr = (a)->ctx_buf_top)  		

/* not in SH_SMALL */
#ifdef	SH_SMALL
#define	CTX_MODEL_TRANSFORMset(a,b,c)
#define	CTX_VDC_TRANSFORMset(a,b,c)
#define	CTX_VDC_MAPset(a,b,c)
#define	CTX_CLIP_ORGset(a,b,c)
#define	CTX_CLIP_DIMset(a,b,c)
#define	CTX_PICK_IDset(a,b,c)
#define	CTX_PICK_COUNTset(a,b,c)
#define	CTX_PICK_ORGset(a,b,c)
#define	CTX_PICK_DIMset(a,b,c)
#define	CTX_CLIP_PLANESset(a,b,c)
#define	CTX_HIDDEN_SURFset(a,b,c)
#define	CTX_LIGHTset(a,b,c)
#define	CTX_TRANSPARENCYset(a,b,c)
#define	CTX_DIFFUSEset(a,b,c)
#define	CTX_SPECULARset(a,b,c)
#define	CTX_SPEC_POWERset(a,b,c)
#define	CTX_AMBIENTset(a,b,c)

#else	/* SH_SMALL */
#define	CTX_MODEL_TRANSFORMset(a,b,c) 	CTX_CALL_SET_I(a,b,c)
#define	CTX_VDC_TRANSFORMset(a,b,c)  	CTX_CALL_SET_I(a,b,c)
#define	CTX_VDC_MAPset(a,b,c)		CTX_CHK_N_SET_I(a,b,c)
#define	CTX_CLIP_ORGset(a,b,c)		CTX_CHK_N_SET_pt(a,b,c)
#define	CTX_CLIP_DIMset(a,b,c)		CTX_CHK_N_SET_pt(a,b,c)
#define	CTX_PICK_IDset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_PICK_COUNTset(a,b,c)	CTX_CALL_SET_I(a,b,c)
#define	CTX_PICK_ORGset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_PICK_DIMset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_CLIP_PLANESset(a,b,c)	CTX_CHK_N_SET_I(a,b,c)
#define	CTX_HIDDEN_SURFset(a,b,c)	CTX_CHK_N_SET_I(a,b,c)
#define	CTX_LIGHTset(a,b,c)		CTX_CALL_SET_I(a,b,c)
#define	CTX_TRANSPARENCYset(a,b,c)	CTX_CALL_SET_F(a,b,c)
#define	CTX_DIFFUSEset(a,b,c)		CTX_CALL_SET_F(a,b,c)
#define	CTX_SPECULARset(a,b,c)		CTX_CALL_SET_F(a,b,c)
#define	CTX_SPEC_POWERset(a,b,c)	CTX_CALL_SET_F(a,b,c)
#define	CTX_AMBIENTset(a,b,c)		CTX_CALL_SET_F(a,b,c)
#endif	/* SH_SMALL */

#define	_CLASS_CTX	1
#endif					/* end if _CLASS_CTX */
