    PEX Protocol Encoding, Version 1.2 23 September 1988
    Copyright (c) 1988 Massachusetts Institute of Technology

 Permission to use, copy, modify, and distribute this document for any purpose
 and without fee is hereby granted, provided that the above copyright notice
 appear in all copies and that both that copyright notice and this permission
 notice are retained, and that the name of M.I.T. not be used in advertising or
 publicity pertaining to this document without specific, written prior
 permission.  M.I.T. makes no representations about the suitability of this
 document or the encoding defined in this document for any purpose.  It is
 provided "as is" without express or implied warranty.

 Author: Todd Newman
     Digital Equipment Corporation
     Workstation Systems Engineering
     100 Hamilton Avenue
     Palo Alto, CA 94301

 This is a companion to the document: "PEX Protocol Specification,
 Version 3.20". The sections are numbered to match that document.

_______________________________________________________________________________


SECTION 1. Acknowledgements


 I'd like to thank Randi Rost and Jeff Friedberg for their help in explaining
 the original intent of the architecture team. I'd also like to acknowledge
 Sally Barry for her help and patience.


SECTION 2. PEX Protocol Specification


2.1 Protocol Format

2.1.1 Request Format
(Requests are listed started in section 4, with section 3 containing a
 description of Output commands.)
2.1.2 Reply Format
(Replies are list after the request.)
2.1.3 Error Format
(See section 2.4.6 for the encoding of particular errors)
2.1.4 Event Format
(PEX defines no new events.)

2.2 Syntax
 This is the only statement in this section.

2.3 Naming Conventions
 This is the only statement in this section.

2.4 Common Types

 The types listed in this section list are some of the types mentioned in
 the PEX protocol.  Generally, derivative types (e.g. ENUM_TYPE_INDEX) have
 been replaced by the primitive or primitives of which they are composed
(e.g. INT16).  Only when this was impractical has the derivivative type
 been used, generally this is when the type is of variable length or a
 list of compound types is used. 

2.4.1 LISTofFOO
 In this document, a LISTofFOO is a counted list of elements of type FOO;
 the count field having preceded it in the request or reply. 

 In cases where number of items in the list is easily computed from the length 
 of the list, the number of items may not have been supplied. (See, for
 example, Get Predefined Entries.) The goal has been to reduce the burden on
 the client. Such cases should be indicated in the encoding document.

 Unless otherwise marked, a LISTofLISTofFOO will be implemented as follows:
 somewhere in the request or reply there will be a numLists field (perhaps
 serveral if there are multiple lists of lists). Each LIST will be preceded by
 a CARD32 count field.
 So the overall format is:
 4	CARD32		numLists
. . .			(potentially other things here)
 4	CARD32		length of first list
 n	FOO		first item of first list
 n	FOO		second item of first list
. . .
 n	FOO		last item of first list
 4	CARD32		length of second list
 n	FOO		first item of second list
. . .


2.4.2 BITMASK, BITMASK_ARRAY and LISTofVALUE
 BITMASK_ARRAY appears nowhere but here in the encoding document.  Where it
 appeared in the Protocol document it has been replaced with a fixed size
 array of BITMASKs (see PC_BITMASK).

 Because the values in a value list are of variable size, a list of values
 can only be interpreted serially; there is no way to find the Nth element
 without examining the N-1 previous elements.

 Elements have all been padded to multiple of 4 bytes.  If values appear
 which could be encoded in less space, it is assumed that they will be 
 placed in the least significant bits of the word.  (Byteswapping may occur
 between the client and the server.)

2.4.3 Floating Point Format - FLOAT
 A FLOAT is a 4 byte quantity in one of the server supported formats.  If
 the client wishes to communicate with the server in other than the server's
 native floating point format, the server must perform the necessary 
 conversions.  The format word of a request tells the server what format the
 client wishes to use.

2.4.4 Colors

 This is the only statement in this section. 

2.4.5 Element Types
 This is the only statement in this section.

2.4.6 Types

 The follow compound types appear in the rest of the encoding document. 
 If a variable  is given which computes the length of a compound type (e.g., 
 the equation for f in FACET), that variable may be used later to express
 the length of a request or reply (e.g. the request Fill Area 3D with Data).

ASF_ATTRIBUTE
 4	CARD32		enables
 4	CARD32		asfs

CHARINFO
 4	FLOAT		left bearing
 4	FLOAT		right bearing
 4	FLOAT		width
 4	FLOAT		ascent
 4	FLOAT		descent

COLOR SPECIFIER
 2	CARD16		color type
    0	Indexed
    1	Direct	
 2			pad
		    n = ((color type == Indexed)||(format == RGBInt8) ? 1 :
			((format == RGBInt16) ? 2 : 3)
 4n			color value 
		    (usually, the format word controls interpretation of direct
		     color values)

COORD_2D
 4	FLOAT		x
 4	FLOAT		y


COORD_3D
 4	FLOAT		x
 4	FLOAT		y
 4	FLOAT		z


DRAWABLE_COORD
 2	CARD16		x
 2	CARD16		y
 4	FLOAT		z

ELEMENT REF
 4	CARD32		structure ID
 4	CARD32		offset


FACET
(maximum size, some fields may be missing, see below)
 4	v		number of vertices in list
 df			OPT_DATA (c and n may be, but s is never set)
 v(12+dv)		LISTofVERTEX

(let f be the size of a FACET in bytes
 let df be the size of the per facet OPT_DATA
 let dv be the size of the per vertex OPT_DATA
 let fc = facet attributes & 0x001
 let fn = facet attributes & 0x002
 fi is true if facet color is indexed, false if color is direct. Then
 df = (fc ? (fi ? 12 : 4) : 0 ) + (fn ? 12 : 0)
 let vc = vertex attributes & 0x001
 let vn = vertex attributes & 0x002
 let ve = vertex attributes & 0x004
 vi is true if vertex color is indexed, false if color is direct. Then
 dv = (vc ? (ii ? 12 : 4) : 0 ) + (vn ? 12 : 0) + (ve ? 4 : 0)
 so f = 4 + df + v * (12 + dv)
)


FONTINFO 
 2	CARD16		first glyph
 2	CARD16		last glyph
 2			all glyphs exist
    0	False
    1	True
 2	CARD16		default glyph
 4	FLOAT		left bearing min bounds
 4	FLOAT		right bearing min bounds
 4	FLOAT		width min bounds
 4	FLOAT		ascent min bounds
 4	FLOAT		descent min bounds
 4	FLOAT		left bearing max bounds
 4	FLOAT		right bearing max bounds
 4	FLOAT		width max bounds
 4	FLOAT		ascent max bounds
 4	FLOAT		descent max bounds
 4	FLOAT		cap ratio
 4	FLOAT		base ratio
 4	n		number of properties
 8n			LISTofFONTPROP


FONTPROP
 4	CARD32		name
 4	FLOAT|CARD32	value

HALF_SPACE
 4	FLOAT		point	x
 4	FLOAT		point	y
 4	FLOAT		point	z
 4	FLOAT		vector	x
 4	FLOAT		vector	y
 4	FLOAT		vector	z


HALF_SPACE_2D
 4	FLOAT		point	x
 4	FLOAT		point	y
 4	FLOAT		vector	x
 4	FLOAT		vector	y

OPT_DATA
(maximum size, some fields may be missing, see below)
		    c = ((color type == Indexed)||(format == RGBInt8) ? 1 :
			((format == RGBInt16) ? 2 : 3)
 4c			color value
		    (the format word controls interpretation of direct
		     color values)
 4	FLOAT		normal vector x
 4	FLOAT		normal vector y
 4	FLOAT		normal vector z
 2			switch
    0	Off
    1	On
 2			unused

(let d be the size of an OPT_DATA in bytes.
 c is true if control word specifies a color is present.
 n is true if control word specifies a normal is present. 
 s is true if control word specifies an edge switch is present .
 i is true if color is indexed, false if color is direct.
 f is 1 if color format is RGBInt8
      2 if color format is RGBInt16
      3 otherwise. Then
 d = 4 + (c ? ((i || (f == 1)) ? 4 : ((f == 2) ? 8 : 12)) : 0)
	    + (n ? 12 : 0) + (s ? 4 : 0)
)

PICK ELEMENT REF
 4	CARD32		structure ID
 4	CARD32		offset
 4	CARD32		pick ID

STRING
 2	n		(CARD16) length
 n	CARD8		string
 p			unused, p=pad(n)

TRIM_CURVE (24+4*(k+pt))
 2			coord type 
    0	Rational
    1	NonRational	(t = (coordtype == rational) ? 4 : 3)
 1	CARD8		visibility
	0	Off
	1	On
 1			unused
 4	CARD32		order
 4	FLOAT		tmin
 4	FLOAT		tmax
 4	p		numPoints
 4	k		numKnots
 4pt			LISTofCOORD (points)
 4k	 		LISTofFLOAT

VERTEX	
 4	FLOAT		point	x
 4	FLOAT		point	y
 4	FLOAT		point	z
 d			OPT_DATA (q.v.)

2.4.7 Errors
 B.E.C. is the base error code for the extension, as returned by
 QueryExtension.

DirectColorFormat
 1	0		Error
 1	BEC+0		code
 2	CARD16		sequence number
 4	CARD32		bad format
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

Editing Context
 1	0		Error
 1	BEC+1		code
 2	CARD16		sequence number
 4	CARD32		bad editing context
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

 
FloatingPointFormat
 1	0		Error
 1	BEC+2		code
 2	CARD16		sequence number
 4	CARD32		bad format
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

Label
 1	0		Error
 1	BEC+3		code
 2	CARD16		sequence number
 4	CARD32		bad label
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

LookupTable
 1	0		Error
 1	BEC+4		code
 2	CARD16		sequence number
 4	CARD32		bad table ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

Nameset
 1	0		Error
 1	BEC+5		code
 2	CARD16		sequence number
 4	CARD32		bad nameset ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

Path
 1	0		Error
 1	BEC+6		code
 2	CARD16		sequence number
 4	CARD32		bad path ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

PEXfont
 1	0		Error
 1	BEC+7		code
 2	CARD16		sequence number
 4	CARD32		bad path ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

PhigsWKS
 1	0		Error
 1	BEC+8		code
 2	CARD16		sequence number
 4	CARD32		bad WKS ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

PickMeasure
 1	0		Error
 1	BEC+9		code
 2	CARD16		sequence number
 4	CARD32		bad device ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

PipelineContext
 1	0		Error
 1	BEC+10		code
 2	CARD16		sequence number
 4	CARD32		bad pipeline context ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

Renderer
 1	0		Error
 1	BEC+11		code
 2	CARD16		sequence number
 4	CARD32		bad renderer ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

SearchContext
 1	0		Error
 1	BEC+12		code
 2	CARD16		sequence number
 4	CARD32		bad search context ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

Structure
 1	0		Error
 1	BEC+13		code
 2	CARD16		sequence number
 4	CARD32		bad structure ID
 2	CARD16		minor opcode
 1	CARD8		major opcode
 21			unused

2.5 Events
 This is the only statement in this section.

2.6 Extension Information

2.6.1 GetExtensionInfo

Get Extension
 1	CARD8		opcode (x11 assigned)
 1	1		PEX opcode
 2	2		request length
 2	CARD16		client protocol major version
 2	CARD16		client protocol minor version

Get Extension Reply
 1	1		reply opcode
 1 	   		unused
 2	CARD16		sequence number
 4	(n+p)/4		reply length 
 2	CARD16		protocol major version
 2	CARD16		protocol minor version
 4	CARD32		release number
 4	n		length of vendor name
 4	CARD32		subset information 
 8	       	 	unused
 n			name
 p			unused, p = pad(n)

Get Enumerated Type Info
 1	CARD8		opcode (x11 assigned)
 1	2		PEX opcode
 2	4+(n+p)/4	request length
 4	CARD32		drawable
 4	CARD32		bitmask
    1	index
    2	mnemonic
 4	n	        number of EnumTypes
 n			LISTofENUM_TYPE
    1	MarkerType
    2	ATextStyle
    3	InteriorStyle
    4	HatchStyle
    5	LineType
    6	SurfaceEdgeType
    7	PickDeviceType
    8	PolylineInterpMethod 
    9	CurveApproxMethod
    10	CurveBasis
    11	ReflectionModel
    12	SurfaceInterpMethod
    13	SurfaceApproxMethod
    14	SurfaceBasis
    15	ModelClipOperator
    16	LightType
    17	DirectColorFormat
    18	FloatFormat 
    19	HLHSRMode
    20	PromptEchoType
    21	DisplayUpdateMode
 p			unused, p = pad(n)

Get Enumerated Type Info Reply
 1	1		reply
 1			unused
 2	CARD16		sequence number
 4	max((q+3)/4,0)  reply length (# additional (>5) words in reply)
 4	CARD32		number of lists
 20			pad
 q			LISTofLISTofVALUE


Get Implementation Dependent Constants
 1	CARD8		opcode (x11 assigned)
 1	3		PEX opcode
 2	4 + (2n+p)/4	request length
 2	INT16		floating point format
 2			unused
 4	CARD32		drawable example
 4	n		number of names
 2n			LISTofNAMES
 p			pad, p = pad(n)

Names for Get Implementation Dependent Constants
 All names are 16 bit constants, returns CARD32, unless specified
 Name				Encoding	
 IDChromaticityLuminance         1		returns FLOAT
 IDChromaticityX                 2		returns FLOAT
 IDChromaticityY                 3		returns FLOAT
 IDDitheringSupported            4
 IDMaxEdgeWidth                  5
 IDMaxLineWidth                  6
 IDMaxMarkerSize                 7
 IDMaxModelClipPlanes            8
 IDMaxNameSetNames               9
 IDMaxNonAmbientLights           10
 IDMaxNURBOrder                  11
 IDMaxTrimCurveOrder             12
 IDMaxUPPOrder                   13
 IDMinEdgeWidth                  14
 IDMinLineWidth                  15
 IDMinMarkerSize                 16
 IDNominalEdgeWidth              17
 IDNominalLineWidth              18
 IDNominalMarkerSize             19
 IDNumSupportedEdgeWidths        20
 IDNumSupportedLineWidths        21
 IDNumSupportedMarkerSizes       22
 IDRgbBestApproximation          23
	0	no win if number reds/greens/blues is a power of 2
	1	wins if number of reds/# greens/#blues are all powers of 2 
 IDTransparencySupported         24

Get Implementation Dependent Constants Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n		reply length
 24			unused
 4n			LISTofVALUES
 p			pad, p=pad(n)

SECTION 3. Output Commands


3.1 Data Formats
 This is the only statement in this section.

3.2 Output Command Descriptions

Marker Type
 2	1		output command number
 2	2		output command length
 2	CARD16		marker type
 2			unused

Marker Scale
 2	2		output command number
 2	2		output command length
 4	FLOAT		marker scale

Marker Color Index
 2	3		output command number
 2	2		output command length
 2	CARD16		table index
 2			unused

Marker Color
 2	4		output command number
 2	2+n		output command length
 4+4n	ColorSpecifier  

Marker Bundle Index
 2	5		output command number
 2	2		output command length
 2	CARD16		table index
 2			unused

Text Font Index
 2	6		output command number
 2	2		output command length
 2	CARD16		table index
 2			unused

Text Precision
 2	7		output command number
 2	2		output command length
 2			precision
    0	String
    1	Char
    2	Stroke
 2			unused

Character Expansion
 2	8		output command number
 2	2		output command length
 4	FLOAT		character expansion

Character Spacing
 2	9		output command number
 2	2		output command length
 4	FLOAT		character spacing

Text Color Index
 2	10		output command number
 2	2		output command length
 2	CARD16		table index
 2			unused

Text Color
 2	11		output command number
 2	2+n		output command length
 4+4n	ColorSpecifier  

Character Height
 2	12		output command number
 2	2		output command length
 4	FLOAT		character height

Character Up Vector
 2	13		output command number
 2	3		output command length
 4	FLOAT		2D vector x
 4	FLOAT		2D vector y


Text Path
 2	14		output command number
 2	2		output command length
 2			text path
    0	Up
    1	Left
    2	Right
    3	Down
 2			unused

Text Alignment
 2	15		output command number
 2	2		output command length
 2			text vertical alignment
    0	Normal
    1	Top
    2	Cap
    3	Half
    4	Base
    5	Bottom
 2			text horizontal alignment
    0	Normal
    1	Left
    2	Right
    3	Center

Annotation Text Height
 2	16		output command number
 2	2		output command length
 4	FLOAT		height

Annotation Text Up Vector
 2	17		output command number
 2	3		output command length
 4	FLOAT		2D vector x
 4	FLOAT		2D vector y

Annotation Text Path
 2	18		output command number
 2	2		output command length
 2			path
    0	Up
    1	Left
    2	Right
    3	Down
 2			unused

Annotation Text Alignment
 2	19		output command number
 2	2		output command length
 2			text vertical alignment
    0	Normal
    1	Top
    2	Cap
    3	Half
    4	Base
    5	Bottom
 2			text horizontal alignment
    0	Normal
    1	Left
    2	Right
    3	Center

Annotation Text Style
 2	20		output command number
 2	2		output command length
 2	INT16		index
 2			unused

Text Bundle Index
 2	21		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Line Type
 2      22              output command number
 2       2               output command length
 2       INT16		index
 2                       unused


Line Width
 2	23		output command number
 2	2		output command length
 4	FLOAT		width

Line Color Index
 2	24		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Line Color
 2	25		output command number
 2	2+n		output command length
 4+4n	ColorSpecifier  

Curve Approximation Method
 2	26		output command number
 2	3		output command length
 2	INT16		index display method
 2			unused
 4	FLOAT		tolerance

Polyline Interpolation Method
 2	27		output command number
 2	2		output command length
 2	CARD16		polyline interp
 2			unused

Line Bundle Index
 2	28		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Surface Interior Style
 2	29		output command number
 2	2		output command length
 2	INT16		interior style
 2			unused

Surface Interior Style Index
 2	30		output command number
 2	2		output command length
 2	CARD16|INT16	type or table index
 2			unused

Surface Color Index
 2	31		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Surface Color
 2	32		output command number
 2	2+n		output command length
 4+4n	ColorSpecifier  

Surface Reflection Attributes
 2	33		output command number
 2	7+n		output command length
 4	FLOAT		ambient
 4	FLOAT		diffuse
 4	FLOAT		specular
 4	FLOAT		specular conc
 4	FLOAT		transmission coef
 4+4n	ColorSpecifier  specular color

Surface Reflection Model
 2	34		output command number
 2	2		output command length
 2	INT16		reflection model
 2			unused

Surface Interpolation Method
 2	35		output command number
 2	2		output command length
 2	INT16		surface interp
 2			unused

Backface Surface Interior Style
 2	36		output command number
 2	2		output command length
 2	INT16		interior style
 2			unused

Backface Surface Interior Style Index
 2	37		output command number
 2	2		output command length
 2	INT16		type or table index
 2			unused

Backface Surface Color Index
 2	38		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Backface Surface Color
 2	39		output command number
 2	2+n		output command length
 4+4n	ColorSpecifier  
Backface Surface Reflection Attributes
 2	40		output command number
 2	7+n		output command length
 4	FLOAT		ambient
 4	FLOAT		diffuse
 4	FLOAT		specular
 4	FLOAT		specular conc
 4	FLOAT		transmission coef
 4+4n	ColorSpecifier  specular color

Backface Surface Reflection Model
 2	41		output command number
 2	2		output command length
 2	INT16		index
 2			unused

Backface Surface Interpolation Method
 2	42		output command number
 2	2		output command length
 2	INT16		index
 2			unused

Surface Approximation 
 2	43		output command number
 2	4		output command length
 2	INT16		index
 2			unused
 4	FLOAT		tolerance s
 4	FLOAT		tolerance t

Trim Curve Approximation 
 2	44		output command number
 2	3		output command length
 2	INT16		index
 2			unused
 4	FLOAT		tolerance 

Facet Culling Mode
 2	45		output command number
 2	2		output command length
 2			cull mode
    0	None
    1	BackFaces
    2	FrontFaces
 2			unused 

Facet Distinguish Flag
 2	46		output command number
 2	2		output command length
 2			distinguish
    0	False
    1	True
 2			unused

Normal Reorientation Mode
 2	47		output command number
 2	2		output command length
 2			normal flip
    0	False
    1	True
 2			unused

Pattern Size
 2	48		output command number
 2	3		output command length
 4	FLOAT		2D size x
 4	FLOAT		2D size y


Pattern Reference Point
 2	49		output command number
 2	3		output command length
 4	FLOAT		2D point x
 4	FLOAT		2D point y

Pattern Reference Point and Vectors 
 2	50		output command number
 2	10		output command length
 4	FLOAT		3D ref point x
 4	FLOAT		3D ref point y
 4	FLOAT		3D ref point z
 4	FLOAT		3D vector 1 x
 4	FLOAT		3D vector 1 y
 4	FLOAT		3D vector 1 z
 4	FLOAT		3D vector 2 x
 4	FLOAT		3D vector 2 y
 4	FLOAT		3D vector 2 z

Interior Bundle Index
 2	51		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Surface Edge Flag
 2	52		output command number
 2	2		output command length
 1			switch
    0	Off
    1	On
 3			unused

Surface Edge Type
 2	53		output command number
 2	2		output command length
 2	INT16		index
 2			unused

Surface Edge Width
 2	54		output command number
 2	2		output command length
 4	FLOAT		width

Surface Edge Color Index
 2	55		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Surface Edge Color
 2	56		output command number
 2	2+n		output command length
 4+4n	ColorSpecifier  

Edge Bundle Index
 2	57		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Set Individual ASF
 2	58		output command number
 2	3		output command length
 4			ASF attribute
	0x00000001	MarkerTypeAsf
	0x00000002	MarkerScaleAsf
	0x00000004	MarkerColorAsf
	0x00000008	TextFontIndexAsf
	0x00000010	TextPrecAsf
	0x00000020	CharExpansionAsf
	0x00000040	CharSpacingAsf
	0x00000080	TextColorAsf
	0x00000100	LineTypeAsf
	0x00000200	LineWidthAsf
	0x00000400	LineColorAsf
	0x00000800	CurveApproxAsf
	0x00001000	PolylineInterpAsf
	0x00002000	InteriorStyleAsf
	0x00004000	InteriorStyleIndexAsf
	0x00008000	SurfaceColorAsf
	0x00010000	SurfaceInterpAsf
	0x00020000	ReflectionModelAsf
	0x00040000	ReflectionAttrAsf
	0x00080000	BfInteriorStyleAsf
	0x00100000	BfInteriorStyleIndexAsf
	0x00200000	BfSurfaceColorAsf
	0x00400000	BfSurfaceInterpAsf
	0x00800000	BfReflectionModelAsf
	0x01000000	BfReflectionAttrAsf
	0x02000000	SurfaceApproxAsf
	0x04000000	TrimCurveApproxAsf
	0x08000000	SurfaceEdgesAsf	
	0x10000000	SurfaceEdgeTypeAsf
	0x20000000	SurfaceEdgeWidthAsf
	0x40000000	SurfaceEdgeColorAsf
 4			ASF value
    0	Bundled
    1	Individual


Local Transform 3D
 2	59		output command number
 2	18		output command length
 2			Composition
    0	PreConcatenate
    1	PostConcatenate
    2	Replace
 2			unused
 64	FLOAT[4][4]	matrix	

Local Transform 2D
 2	60		output command number
 2	11		output command length
 2			Composition
    0	PreConcatenate
    1	PostConcatenate
    2	Replace
 2			unused
 36	FLOAT[3][3]	matrix	

Global Transform 3D
 2	61		output command number
 2	17		output command length
 64	FLOAT[4][4]	matrix	

Global Transform 2D
 2	62		output command number
 2	10		output command length
 36	FLOAT[3][3]	matrix	

Model Clip
 2	63		output command number
 2	2		output command length
 1			onoff
    0	Off
    1	On
 3			unused

Set Model Clip Volume 3D
 2	64		output command number
 2	2+6n		output command length
 2	CARD16		operator
 2	n		number halfspaces
 6n			List of HalfSpaces

Set Model Clip Volume 2D
 2	65		output command number
 2	2+4n		output command length
 2	CARD16		operator
 2	n		number halfspace2Ds
 4n			List of HalfSpace2Ds

Restore Model Clip Volume 
 2	66		output command number
 2	1		output command length

View Index
 2	67		output command number
 2	2		output command length
 2	CARD16		index
 2			unused


Light Source State
 2	68		output command number
 2	3		output command length
 4	CARD32		enable bitmask
 4	CARD32		disable bitmask

Depth Cue Index
 2	69		output command number
 2	2		output command length
 2	CARD16		index
 2			unused

Pick ID
 2	70		output command number
 2	2		output command length
 4	CARD32		pick id

HLHSR Identifier
 2	71		output command number
 2	2		output command length
 4	CARD32		HLHSR id

Add Names to Name Set
 2	72		output command number
 2	2+n		output command length
 4n	CARD32		list of names (length implicit)


Remove Names from Name Set
 2	73		output command number
 2	2+n		output command length
 4n	CARD32		list of names (length implicit)

Execute Structure
 2	74		output command number
 2	2		output command length
 4	CARD32		structure ID

Label
 2	75		output command number
 2	2		output command length
 4	CARD32		label

Application Data
 2	76		output command number
 2	2+(n+p)/4	output command length
 2	n		length of data
 2			unused
 n	CARD8		data
 p			unused, p = pad(n)

GSE
 2	77		output command number
 2	3+(n+p)/4	output command length
 4	CARD32		id
 2	n		length of data
 2			unused
 n	CARD8		data
 p			unused, p = pad(n)

Marker 3D
 2	78		output command number
 2	1+3n		output command length
 12n			LISTofCOORD_3D


Marker 2D
 2	79		output command number
 2	1+2n		output command length
 8n			LISTofCOORD_2D

Text3D
 2	80		output command number
 2	11+(n+p)/4	output command length
 4	FLOAT		origin x
 4	FLOAT		origin y
 4	FLOAT		origin z
 4	FLOAT		vector1 x
 4	FLOAT		vector1 y
 4	FLOAT		vector1 z
 4	FLOAT		vector2 x
 4	FLOAT		vector2 y
 4	FLOAT		vector2 z
 2	n		length of string
 2			unused
 n	CARD8		LISTofBYTE
 p			unused, p = pad(n)

Text2D
 2	81		output command number
 2	4+(n+p)/4	output command length
 4	FLOAT		origin x
 4	FLOAT		origin y
 2	n		length of string
 2			unused
 n	CARD8		LISTofBYTE
 p			unused, p = pad(n)

Annotation Text3D
 2	82		output command number
 2	8+(n+p)/4	output command length
 4	FLOAT		origin x
 4	FLOAT		origin y
 4	FLOAT		origin z
 4	FLOAT		offset x
 4	FLOAT		offset y
 4	FLOAT		offset z
 2	n		length of string
 2			unused
 n	CARD8		LISTofBYTE
 p			unused, p = pad(n)

Annotation Text2D
 2	83		output command number
 2	6+(n+p)/4	output command length
 4	FLOAT		origin x
 4	FLOAT		origin y
 4	FLOAT		offset x
 4	FLOAT		offset y
 2	n		length of string
 2			unused
 n	CARD8		LISTofBYTE
 p			unused, p = pad(n)

Polyline3D
 2	84		output command number
 2	1+3n		output command length
 12n			LISTofCOORD_3D

Polyline2D
 2	85		output command number
 2	1+2n		output command length
 8n			LISTofCOORD_2D

Polyline Set 3D with Data
 (let d be the size of an OPT_DATA
 and m be the number of vertices in the list of lists)
 2	86		output command number
 2	3+n+md/4	output command length
 2			color type
    0	Indexed
    1	Direct	
 2	CARD16		bitmask vertex attribs
    #00000001	color
 4	n		number of lists
 4n+m*d			LISTofLISTofVERTEX

Parametric Curve
 2	87		output command number
 2	4+tp		output command length
 2	INT16		curve basis
 2	CARD16		curve order
 2			coord type
    0	Rational
    1	NonRational	(t = (coordtype == rational) ? 4 : 3)
 2			unused
 4	p	number of points
 4t*p			LISTofCOORD (COORD_3D or COORD_4D based on t)
    
Non-Uniform B Spline Curve
 2	88		output command number
 2	6+k+tp		output command length
 2	CARD16		curve order
 2			curve type
    0	Rational
    1	NonRational	(t = (curvetype == rational) ? 4 : 3)
 4	FLOAT		tmin
 4	FLOAT		tmax
 4	k		number of knots
 4	p		number of points
 4k			LISTofFLOAT	knots
 4t*p			LISTofCOORD (COORD_3D or COORD_4D based on t)

Fill Area 3D
 2	89		output command number
 2	2+3p		output command length
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2			ignore edges
    0	False
    1	True
 12p			LISTofCOORD_3D (no count, length implicit)

Fill Area 2D
 2	90		output command number
 2	2+2p		output command length
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2			ignore edges
    0	False
    1	True
 8p			LISTofCOORD_2D (no count, length implicit)

Fill Area 3D with Data
 2	91		output command number
 2	4+f/4		output command length
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2			ignore edges
    0	False
    1	True
 2			ColorType
    0	Indexed
    1	Direct	
 2			bitmask facet attribs
    0x0001	color
    0x0002	normal
 2			bitmask vertex attribs
    0x0001	color
    0x0002	normal
 2			unused
 f			FACET


Fill Area Set 3D
 2	92		output command number
 2	3+n+3m		output command length
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2			ignore edges
    0	False
    1	True
 4	n		number of lists
 4n+12m			LISTofLISTofCOORD_3D

Fill Area Set 2D
 2	93		output command number
 2	3+n+2m		output command length
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2			ignore edges
    0	False
    1	True
 4	n		number of lists
 4n+8m			LISTofLISTofCOORD_2D

Fill Area Set 3D with Data
 2	94		output command number
 2	5+(d+v)/4	output command length
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2			ignore edges
    0	False
    1	True
 2			ColorType
    0	Indexed
    1	Direct	
 2			bitmask facet attribs
    0x0001	color
    0x0002	normal
 2			bitmask vertex attribs
    0x0001	color
    0x0002	normal
    0x0004  edge
 2			unused
 4	CARD32		number of lists
 d      OPT_DATA	facet data
 v			LISTofLISTofVERTEX


Triangle Strip
 2	95		output command number
 2	4+(p-2)d+pv)/4	output command length
 2			ColorType
    0	Indexed
    1	Bundled
 2			bitmask facet attribs
    0x0001	color
    0x0002	normal
 2			bitmask vertex attribs
    0x0001	color
    0x0002	normal
 2			unused
 4	p		number of points 
(p-2)d			LISTofOPT_DATA	
 pv			LISTofVERTEX

Quadrilateral Mesh
 2	96		output command number
 2	4+m*n(d+v)/4	output command length
 2			ColorType
    0	Indexed
    1	Direct	
 2	CARD16		m_pts
 2	CARD16		n_pts
 2			bitmask facet attribs
    0x0001	color
    0x0002	normal
 2			bitmask vertex attribs
    0x0001	color
    0x0002	normal
 2			unused
 m*n*d			LISTofOPT_DATA
 m*n*v			LISTofVERTEX

Indexed Polygon
 2	97		output command number
 2	5+(2fc+p1+n*d+ve+p2+vl)/4 output command length 
 2			shape
    0	Complex
    1	Nonconvex
    2	Convex
    3	Unknown
 2	CARD16		ColorType
    0	Indexed
    1	Direct	
 2			bitmask facet attribs
    0x0001	color
    0x0002	normal
 2			bitmask vertex attribs
    0x0001	color
    0x0002	normal
 2			bitmask edge attribute
    0	Off	   (call this value e)
    1	On
 2			unused
 4	fc		number of facet counts
 2fc	LISTofCARD16	facet counts (let n be the sum of these counts)
 p1			pad, p = Pad(2fc)
 n*d	LISTofOPT_DATA	facet_data
			let ve = n * (e ? 4 : 2)
 ve	 LISTofVERTEX_INDEX	edge data
 p2			unused, p = Pad(n*(e?4:2))
 			let vl = n * (12+(d based on vertex attribs))
 vl	LISTofVERTEX	vertices


Parametric Polynomial Surface
 2	98		output command number
 2	4+vt		output command length 
 2	CARD16		basis
 2			surface type
    0	Rational
    1	NonRational	(t = (curvetype == rational) ? 4 : 3)
 2	CARD16		surface u-order
 2	CARD16		surface v-order
 4	v		number of vertices
 v*4t			LISTofCOORD 

Non-Uniform B-Spline Surface
 2	99		output command number
 2	11+uk+vk+qs+6+k+pt Output command length 
 2			Coord type
    0	Rational
    1	NonRational	(s = (coordtype == rational) ? 4 : 3)
 2	CARD16		surface u-order
 2	CARD16		surface v-order
 2			pad
 4	FLOAT		umin
 4	FLOAT		umax
 4	FLOAT		vmin
 4	FLOAT		vmax
 4	uk		numUknots
 4	vk		numVknots
 4	q		number of points		
 4	t		number of trim curves		
 4uk			LISTofFLOAT
 4vk			LISTofFLOAT
 q*4s			LISTofCOORD
 ??			LISTofLISTofTRIM_CURVE (see TRIM_CURVE for k, p, and t)

Cell Array 3D
 2	100		output command number
 2	12+(2q+p)/4	output command length 
 4	FLOAT		point 1 x
 4	FLOAT		point 1 y
 4	FLOAT		point 1 z
 4	FLOAT		point 2 x
 4	FLOAT		point 2 y
 4	FLOAT		point 2 z
 4	FLOAT		point 3 x
 4	FLOAT		point 3 y
 4	FLOAT		point 3 z
 4	CARD32		dx
 4	CARD32		dy (let q = dx * dy)
 2q	CARD16		table indices
 p			unused, p = pad(q)

Cell Array 2D
 2	101		output command number
 2	7+(2s+p)/4	output command length 
 2	CARD16		color type
 2			unused
 4	FLOAT		point 1 x
 4	FLOAT		point 1 y
 4	FLOAT		point 2 x
 4	FLOAT		point 2 y
 4	CARD32		dx
 4	CARD32		dy (let s = dx * dy)
 2s	CARD16		table indices
 p			unused, p = pad(s)

Extended Cell Array 3D
 2	102		output command number
 2	13+p*n		output command length 
 2			ColorType
    0	Indexed
    1	Direct	
 2			unused
 4	FLOAT		point 1 x
 4	FLOAT		point 1 y
 4	FLOAT		point 1 z
 4	FLOAT		point 2 x
 4	FLOAT		point 2 y
 4	FLOAT		point 2 z
 4	FLOAT		point 3 x
 4	FLOAT		point 3 y
 4	FLOAT		point 3 z
 4	CARD32		dx
 4	CARD32		dy (let p = dx * dy)
 p*n			(unlike the usual case, colors are 4 or 12 bytes.)

GDP 3D
 2	103		output command number
 2	4+3p+(d+q)/4	output command length
 4	CARD32		gdp id
 4	p		number of points
 4	d		number of bytes of data
 12p			LISTofCOORD_3D
 d			LISTofBYTES
 q			pad, q = pad(d)


GDP 2D
 2	104		output command number
 2	4+2p+(d+q)/4	output command length
 4	CARD32		gdp id
 4	p		number of points
 4	d		number of bytes of data
 8p			LISTofCOORD_2D
 d			LISTofBYTES
 q			pad, q = pad(d)


SECTION 4. Lookup Tables

LineBundle  (20+4n)
 2	INT16		line type
 2	INT16		polyline interp
 2	INT16		curve approx method
 2			unused
 4	FLOAT		tolerance
 4	FLOAT		line width
 4+4n	ColorSpecifier  

MarkerBundle (12+4n)
 2	INT16		marker type
 2			unused
 4	FLOAT		marker scale
 4+4n	ColorSpecifier  

TextBundle (16+4n)
 2	CARD16		font table index
 2			text precision
    0	String
    1	Char
    2	Stroke
 4	FLOAT		char expansion
 4	FLOAT		char spacing
 4+4n	ColorSpecifier  

InteriorBundle (58+8n)
 2	INT16		interior style
 2	INT16		interior style index
 2	INT16		reflection model
 2	INT16		surface interp
 2	INT16		bf interior style
 2	INT16		bf interior style index
 2	INT16		bf reflection model
 2	INT16		bf surface interp
 2	INT16		surface approx method
 2			unused
 4	FLOAT		surface approx s tolerance
 4	FLOAT		surface approx t tolerance
 2	INT16		curve approx method
 2			unused
 4	FLOAT		curve approx tolerance
 4+4n	ColorSpecifier  surface color
 4	FLOAT		reflection attributes - ambient
 4	FLOAT		reflection attributes - diffuse
 4	FLOAT		reflection attributes - specular
 4	FLOAT		reflection attributes - specular conc
 4	FLOAT		reflection attributes - transmission coef
 4+4n	ColorSpecifier  reflection attributes - specular color
 4+4n	ColorSpecifier	bf surface color - color specifier 
 4	FLOAT		bf reflection attributes - ambient
 4	FLOAT		bf reflection attributes - diffuse
 4	FLOAT		bf reflection attributes - specular
 4	FLOAT		bf reflection attributes - specular conc
 4	FLOAT		bf reflection attributes - transmission coef
 4+4n	ColorSpecifier	bf reflection attributes - specular color

EdgeBundle (12+4n)
 2			surface edges
    0	Off
    1	On
 2	INT16		surface edge type
 4	FLOAT		surface edge width
 4+4n	ColorSpecifier  surface edge color

PatternBundle (12+c*4n)
 2			color type
    0	Indexed
    1	Direct	
 2	CARD16		numx
 2	CARD16		numy
 2			unused
 c*4n			LISTofCOLOR

ColorBundle (4n)
	    n = ((color type == Indexed)||(format == RGBInt8) ? 1 :
		((format == RGBInt16) ? 2 : 3)
 4n			color

TextFontBundle (4)
 4	CARD32		font ID

ViewBundle (156)
 2 			clip flags
 	0x0001		clip_xy
 	0x0002		clip_back
 	0x0004		clip_front
 2			unused
 4	FLOAT		x min
 4	FLOAT		y min
 4	FLOAT		z min
 4	FLOAT		x max
 4	FLOAT		y max
 4	FLOAT		z max
 64	MATRIX		orientation
 64	MATRIX		mapping

Light (48+4n)
 2	INT16		light type
 2			unused
 4	FLOAT		x direction
 4	FLOAT		y direction
 4	FLOAT		z direction
 4	FLOAT		x point
 4	FLOAT		y point
 4	FLOAT		z point
 4	FLOAT		concentration
 4	FLOAT		spread angle
 4	FLOAT		attenuation factor 1
 4	FLOAT		attenuation factor 2
 4+4n	ColorSpecifier  

DepthCue (24+4n)
 1			mode
    0	Off
    1	On
 3			unused
 4	FLOAT		front plane
 4	FLOAT		back  plane
 4	FLOAT		front scaling
 4	FLOAT		back scaling
 4+4n	ColorSpecifier  depth cue color

RGBApprox (24)
 2	CARD16		red max
 2	CARD16		green max
 2	CARD16		blue max
 2			dither
    0	Off
    1	On
 4	CARD16		red multiplier
 4	CARD16		green multiplier
 4	CARD16		blue multiplier
 4	CARD32		base pixel


Intensity Approx (8)
 4	CARD32		base pixel
 2	CARD16		intensity max
 2			dither
    0	Off
    1	On

4.1 Lookup Table Resource Management

Create Lookup Table 
 1	CARD8		opcode (x11 assigned)
 1	4		PEX opcode
 2	4		request length
 4	CARD32		drawable ID
 4	CARD32		Lookup table ID
 2			table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
 2			unused

Copy Lookup Table
 1	CARD8		opcode (x11 assigned)
 1	5		PEX opcode
 2	3		request length
 4	CARD32		source lookup table ID
 4	CARD32		destination lookup table ID

Free Lookup Table
 1	CARD8		opcode (x11 assigned)
 1	6		PEX opcode
 2	2		request length
 4	CARD32		lookup table ID

4.2 Lookup Table Inquiry

Get Table Info
 1	CARD8		opcode (x11 assigned)
 1	7		PEX opcode
 2	3		request length
 4	CARD32		drawable ID
 2			table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
 2			unused 

Get Table Info Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	0		reply length
 2			table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
 2	CARD16		definable entries
 2	CARD16		num predefined
 2	TABLE_INDEX	predefined min
 2	TABLE_INDEX	predefined max
 14			unused

Get Predefined Entries
 1	CARD8		opcode (x11 assigned)
 1	8		PEX opcode
 2	5		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		drawable
 2			table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
 2	CARD16		start table index
 2	n		count
 2			unused

Get Predefined Entries Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	s*t/4		reply length
 2	t		table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
 2 			unused
 4	CARD32		number of table Entries
 16			unused
 s*t			LISTofTABLE_ENTRY
		    (each entry will be longword aligned)

Get Defined Indices
 1	CARD8		opcode (x11 assigned)
 1	9		PEX opcode
 2	2		request length
 4	CARD32		table id

Get Defined Indices Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(2n+p)/4	reply length
 4	n		number of indices returned
 20			unused
 2n			LISTofTABLE_INDEX
 p			pad, p = 2 * (n % 2)

Get Lookup Table Entry
 1	CARD8		opcode (x11 assigned)
 1	10		PEX opcode
 2	4		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		lookup table id
 2	CARD16		table index
 2			unused

Get Lookup Table Entry Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n		reply length
 2			status
    0	Default
    1	Defined
 2			table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
 20			unused
 4n			table entry


Get Lookup Table Entries
 1	CARD8		opcode (x11 assigned)
 1	11		PEX opcode
 2	4		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		lookup table id
 2	CARD16		table index start
 2	n		count

Get Lookup Table Entries Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(c*s)/4		reply length
 2	t		table type
    1	LineBundle
    2	MarkerBundle
    3	TextBundle
    4	InteriorBundle
    5	EdgeBundle
    6 	Pattern
    7	TextFont
    8	Color
    9	View
    10	Light
    11	DepthCue
    12	RGBApprox
    13	IntensityApprox
			(let s be size of entry of type t)
 2			unused
 4	c		number of table entries
 16			unused
 c*s			LISTofTABLE_ENTRY

4.3 Lookup Table Modification
Set Lookup Table Entries
 1	CARD8		opcode (x11 assigned)
 1	12		PEX opcode
 2	4+??		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		lookup table ID
 2	CARD16		start
 2	n		count
 ?? 			LISTofTABLE_ENTRIES
		    (?? = sum of size of each table entry)
Delete Lookup Table Entries
 1	CARD8		opcode (x11 assigned)
 1	13		PEX opcode
 2	3		request length
 4	CARD32		lookup table ID
 2	CARD16		start
 2	CARD16		count


SECTION 5. Pipeline Contexts


 The following components may appear in the requests Create Pipeline Context
 and Change Pipeline Context; they may also appear in replies to
 GetPipelineContext.  Because the components are not of a fixed size
 (as they are in X11), the list must be parsed serially to know where one
 component ends and the next begins.  A 2 longword bitmap mask specifies
 which components are to be found in a list.  Proceding from the least
 significant bit of the first longword through to the last used bit of the
 last long word, if the bit is set, the next item in the list is of the
 specified type.

PC_BITMASK
Longword 0
    0x00000001	marker type
    0x00000002	marker scale
    0x00000004	marker color
    0x00000008	marker bundle index
    0x00000010	text font
    0x00000020	text precision
    0x00000040	char expansion
    0x00000080	char spacing
    0x00000100	text color
    0x00000200	char height
    0x00000400	char up vector
    0x00000800	text path
    0x00001000	text alignment
    0x00002000	atext height
    0x00004000	atext up vector
    0x00008000	atext path
    0x00010000	atext alignment
    0x00020000	atext style
    0x00040000	text bundle index
    0x00080000	line type
    0x00100000	line width
    0x00200000	line color
    0x00400000	curve approx
    0x00800000	polyline interp
    0x01000000	line bundle index
    0x02000000	interior style
    0x04000000	interior style index
    0x08000000	surface color
    0x10000000	reflection attr
    0x20000000	reflection model
    0x40000000	surface interp
    0x80000000	bf_interior style
LONGWORD 1
    0x00000001	bf interior style index
    0x00000002	bf surface color
    0x00000004	bf reflection attr
    0x00000008	bf reflection model
    0x00000010	bf surface interp
    0x00000020	surface approx
    0x00000040  trim curve approx
    0x00000080	culling mode
    0x00000100	distinguish
    0x00000200	normal flip
    0x00000400	pattern size
    0x00000800	pattern ref pt
    0x00001000	pattern ref vec 1
    0x00002000	pattern ref vec 2
    0x00004000	interior bundle index
    0x00008000	surface edges
    0x00010000	surface edge type
    0x00020000	surface edge width
    0x00040000	surface edge color
    0x00080000	edge bundle index
    0x00100000	local transform
    0x00200000	global transform
    0x00400000	model clip
    0x00800000	model clip volume
    0x01000000	view index
    0x02000000	light state
    0x04000000	depth cue index
    0x08000000	pick id
    0x10000000	asfs
    0x20000000	HLHSR identifier
    0x40000000	name set

ASF flags bits
    0x00000001	marker type asf
    0x00000002	marker scale asf
    0x00000004	marker color asf
    0x00000008	text font asf
    0x00000010	text precison asf
    0x00000020	char expansion asf
    0x00000040	char spacing asf
    0x00000080	text color asf
    0x00000100	line type asf
    0x00000200	line width asf
    0x00000400	line color asf
    0x00000800	curve approx asf
    0x00001000	polyline interp asf
    0x00002000	interior style asf
    0x00004000	interior style index asf
    0x00008000	surface color asf
    0x00010000	surface interp asf
    0x00020000	reflection model asf
    0x00040000	reflection attr asf
    0x00080000	bf interior style asf
    0x00100000	bf interior style index asf
    0x00200000	bf surface color asf
    0x00400000	bf surface interp asf
    0x00800000	bf reflection model asf
    0x01000000	bf reflection attr asf
    0x02000000	surface approx asf
    0x04000000	trim curve approx asf
    0x08000000	surface edges asf
    0x10000000	surface edge type asf
    0x20000000	surface edge width asf
    0x40000000	surface edge color asf

 Component type descriptions

 Note that lengths are the (perhaps padded) lengths sent over the wire, and
 are chosen to make entries align. Types may be smaller than the length field
 into which they are assigned. If the natural type is smaller than the padded
 field, this is equivalent to sending the value in its native type and then
 a pad of (length - native size) bytes.
 If a component has sub-fields, the sizes, types and interpretations of the
 sub-fields are on subsequent lines.

 For example, marker type has a length of 4, but a type of INT16, which is
 only 2 bytes long.  When sending a marker type to a Pipeline Context, we
 therefore send a 2 byte INT16 and 2 bytes of padding.

 When sending a color specifier, we send 2 bytes indicating the color type,
 2 bytes of pad, and either 4, 8, or 16 bytes of color information, depending
 on the direct color type.  We will always have sent already the direct color
 format so that we know what length a direct color will be.

 Attribute Name		Length	Type		
 marker type		4	INT16		
 marker scale		4	FLOAT		
 marker color		4+4n	ColorSpecifier		

 marker bundle index	4	CARD16		
 text font		4	CARD16		
 text precision		4	CARD16		
			    0	String
			    1	Char
			    2	Stroke
 char expansion		4	FLOAT		
 char spacing		4	FLOAT		
 text color		4+4n	ColorSpecifier
 char height		4	FLOAT		
 char up vector		8			
		    4	FLOAT		point	x
		    4	FLOAT		point	y
 text path		4	CARD16		
			    0	Up
			    1	Left
			    2	Right
			    3	Down
 text alignment		4	TEXT_ALIGNMENT	
		    2	text vertical align				
			    0	Normal
			    1	Top
			    2	Cap
			    3	Half
			    4	Base
			    5	Bottom
		    2	text horizontal align				
			    0	Normal
			    1	Left
			    2	Right
			    3	Center

 atext height		4	FLOAT		
 atext up vector	8			
		    4	FLOAT		point	x
		    4	FLOAT		point	y
 atext path		4	CARD16	
			    0	Up
			    1	Left
			    2	Right
			    3	Down
 atext alignment	4	TEXT_ALIGNMENT	
		    2 	text vertical alignment 			
			    0	Normal
			    1	Top
			    2	Cap
			    3	Half
			    4	Base
			    5	Bottom
		    2	text horizontal align				
			    0	Normal
			    1	Left
			    2	Right
			    3	Center
 atext style		4	INT16		
 text bundle index	4	CARD16		
 line type		4	INT16		
 line width		4	FLOAT		
 line color		4+4n	ColorSpecifier
 curve approx		8
			4	INT16		approx method
			4	FLOAT		tolerance
 polyline interp	4	INT16		
 line bundle index	4	CARD16		
 interior style		4	INT16		
 interior style index	4	INT16/CARD16	
 surface color		4+4n	ColorSpecifier
 reflection attr	24+4n			
		    4	FLOAT		ambient coef
		    4	FLOAT		diffuse coef
		    4	FLOAT		specular coef
		    4	FLOAT		specular conc
		    4	FLOAT		transmission coef
		    4+4n ColorSpecifier	specular color
 reflection model	4	INT16
 surface interp		4	INT16		
 bf interior style	4	INT16		
 bf interior style index4	INT16/CARD16	
 bf surface color	4+4n	ColorSpecifier
 bf reflection attr	24+4n			
		    4	FLOAT		ambient coef
		    4	FLOAT		diffuse coef
		    4	FLOAT		specular coef
		    4	FLOAT		specular conc
		    4	FLOAT		transmission coef
		    4+4n ColorSpecifier	specular color
 bf reflection model	4	INT16		
 bf surface interp	4	INT16		
 surface approx		12			
		    4	INT16	surface display
		    4	FLOAT	s tolerance
		    4	FLOAT	t tolerance
 trim curve approx	8
		    2	INT16	method
		    2		unused
		    4	FLOAT	tolerance
 culling mode		4	CARD16		
			    0	None
			    1	BackFaces
			    2	FrontFaces
 distinguish		4	CARD16		
			    0	False
			    1	True
 normalflip		4	CARD16		
			    0	False
			    1	True
 pattern size		8			
		    4	FLOAT	x
		    4	FLOAT	y
 pattern ref pt		12			
		    4	FLOAT	x
		    4	FLOAT	y
		    4	FLOAT	z
 pattern ref vec1	12			
		    4	FLOAT	x
		    4	FLOAT	y
		    4	FLOAT	z
 pattern ref vec2	12			
		    4	FLOAT	x
		    4	FLOAT	y
		    4	FLOAT	z
 interior bundle index	4	CARD16		
 surface edges		4			
			    0	Off
			    1	On
 surface edge type	4	INT16		
 surface edge width	4	FLOAT		
 surface edge color	4+4n	ColorSpecifier
 edge bundle index	4	CARD16		
 local transform	64	FLOAT[4][4]	
 global transform 	64	FLOAT[4][4]	
 model clip		4	CARD16		
			    0	Off
			    1	On
 model clip volume	4+24n			
		    4	n	number half spaces
		    24n		LISTofHALF_SPACE
 view index		4	CARD16		
 light state		4	CARD32		
 depth cue index	4	CARD16		
 asf enables		4	CARD32		
			    if bit for asf flag is set, use corresponding
			    asf value
 asf values		4 	CARD32		
			    if bit in corresponding asf enables, use bit as
			    0 = bundled
			    1 = individual
 pick id		4	CARD32	
 HLHSR identifier	4	CARD32		
 name set		4	CARD32		

5.1 Pipeline Context Resource Management

Create Pipeline Context
 1	CARD8		opcode (x11 assigned)
 1	14		PEX opcode
 2	5+(n+p)/4	request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		Pipeline context ID
 8	PC_BITMASK	item mask
 n			LISTofVALUE
 p			pad, p=pad(n)

Copy Pipeline Context
 1	CARD8		opcode (x11 assigned)
 1	15		PEX opcode
 2	5		request length
 4	CARD32		source pipeline context ID
 4	CARD32		destination pipeline context ID
 8	PC_BITMASK	item mask

Free Pipeline Context
 1	CARD8		opcode (x11 assigned)
 1	16		PEX opcode
 2	2		request length
 4	CARD32		pipeline context

5.2	Pipeline Context Inquiry

Get Pipeline Context
 1	CARD8		opcode (x11 assigned)
 1	17		PEX opcode
 2	5		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		pipeline context ID
 8 	PC_BITMASK	item mask

Get Pipeline Context Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(n+p)/4		reply length
 4	CARD32		number of values
 8	PC_BITMASK	item mask
 12			unused
 n			LISTofVALUE
 p			pad, p=pad(n)

5.3 Pipeline Context Modification
Change Pipeline Context
 1	CARD8		opcode (x11 assigned)
 1	18		PEX opcode
 2	5+(n+p)/4	request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		Pipeline Context ID
 8	PC_BITMASK	item mask
 n			LISTofVALUE
 p			pad, p=pad(n)


SECTION 6. Renderers


R_MASK
    0x00000001	pipeline context
    0x00000002	current path
    0x00000004	marker bundle
    0x00000008	text bundle
    0x00000010	line bundle
    0x00000020	interior bundle
    0x00000040	edge bundle
    0x00000080	view table
    0x00000100	color table
    0x00000200	depth cue table
    0x00000400	light table
    0x00000800	color approx table
    0x00001000	pattern table
    0x00002000	text font table
    0x00004000	highlight inclusion
    0x00008000	highlight exclusion 
    0x00010000	invisibility inclusion
    0x00020000	invisibility exclusion
    0x00040000	renderer state
    0x00080000	HLHSR mode
    0x00100000	NPC subspace
    0x00200000	viewport


 Note that lengths are the (perhaps padded) lengths sent over the wire, and
 are chosen to make entries align. Types may be smaller than the length field
 into which they are assigned. If the natural type is smaller than the padded
 field, this is equivalent to sending the value in its native type and then
 a pad of (length - native size) bytes.
 If a component has sub-fields, the sizes, types and interpretations of the
 sub-fields are on subsequent lines.

 Attribute Name		Length	Type		
 pipeline context	4	CARD32		
 current path		4+8n			
		    4	n	number of element refs
		    8n		LISTofELEMENT_REF
 marker bundle		4	CARD32		
 text bundle		4	CARD32		
 line bundle		4	CARD32		
 interior bundle	4	CARD32		
 edge bundle		4	CARD32		
 view table		4	CARD32		
 color table		4	CARD32		
 depth cue table	4	CARD32		
 light table		4	CARD32		
 color approx table	4	CARD32		
 pattern table		4	CARD32		
 text font table	4	CARD32		
 highlight inclusion	4	CARD32		
 highlight exclusion 	4	CARD32		
 invisibility inclusion	4	CARD32		
 invisibility exclusion	4	CARD32		
 renderer state		4			
			    0	Idle
			    1	Rendering
 HLHSR mode		4	INT16		
 NPC subspace		24			
		    4	FLOAT	x min
		    4	FLOAT	y min
		    4	FLOAT	z min
		    4	FLOAT	x max
		    4	FLOAT	y max
		    4	FLOAT	z max
 viewport		16			
		    2	CARD16	x min
		    2	CARD16	y min
		    4	FLOAT	z min
		    2	CARD16	x max
		    2	CARD16	y max
		    4	FLOAT	z max
		    4	INT16	use drawables
			0	No
			1	Yes






6.1 Renderer Resource Manager

Create Renderer
 1	CARD8		opcode (x11 assigned)
 1	19		PEX opcode
 2	5+(n+p)/4	request length
 2	INT16		floating point format
 2			unused
 4	CARD32		renderer id
 4	CARD32		drawable ID
 4	R_BITMASK	item mask
 n			LISTofVALUE
 p			p, p = pad(n)

Free Renderer
 1	CARD8		opcode (x11 assigned)
 1	20		PEX opcode
 2	2		request length
 4	CARD32		Renderer ID

6.2 Renderer Modification

Change Renderer
 1	CARD8		opcode (x11 assigned)
 1	21		PEX opcode
 2	4+(n+p)/4	request length
 2	INT16		floating point format
 2			unused
 4	CARD32		renderer
 4	R_BITMASK	item mask
 n			LISTofVALUE
 p			pad, p=pad(n)

6.3 Renderer Inquiry

Get Renderer Attributes
 1	CARD8		opcode (x11 assigned)
 1	22		PEX opcode
 2	4		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		renderer ID
 4	R_BITMASK	item mask

Get Renderer Attributes Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(n+p)/4		reply length
 4	R_BITMASK	item mask
 20			unused
 n			LISTofVALUE
 p			pad, p=pad(n)

6.4 Client-Side Traversal Support
Begin Rendering
 1	CARD8		opcode (x11 assigned)
 1	23		PEX opcode
 2	3		request length
 4	CARD32		renderer ID
 4	CARD32		drawable ID

End Rendering
 1	CARD8		opcode (x11 assigned)
 1	24		PEX opcode
 2	2		request length
 4	CARD32		renderer ID

Begin Structure
 1	CARD8		opcode (x11 assigned)
 1	25		PEX opcode
 2	3		request length
 4	CARD32		renderer ID
 4	CARD32		structure ID 

End Structure
 1	CARD8		opcode (x11 assigned)
 1	26		PEX opcode
 2	2		request length
 4	CARD32		renderer ID

6.5 Render Output Commands

Render Output Commands
 1	CARD8		opcode (x11 assigned)
 1	27		PEX opcode
 2	4+??/4		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		Renderer ID
 4	n		number of commands
 ??			LISTofOUTPUT_COMMAND

Render Network
 1	CARD8		opcode (x11 assigned)
 1	28		PEX opcode
 2	4		request length
 4	CARD32		renderer ID
 4	CARD32		drawable ID
 4	CARD32		structure ID 


SECTION 7. Structure Requests


7.1 Structure Resource Management

Create Structure
 1	CARD8		opcode (x11 assigned)
 1	29		PEX opcode
 2	2		request length
 4	CARD32		structure ID 

Copy Structure
 1	CARD8		opcode (x11 assigned)
 1	30		PEX opcode
 2	3		request length
 4	CARD32		source structure ID 
 4	CARD32		destination structure ID 

Free Structure
 1	CARD8		opcode (x11 assigned)
 1	31		PEX opcode
 2	2		request length
 4	CARD32		structure ID 

Delete Structures
 1	CARD8		opcode (x11 assigned)
 1	32		PEX opcode
 2	3+n		request length
 2			delete refs
    0	False
    1	True
 2			unused
 4	CARD32		number structure ID 
 4n			LISTofCARD32

7.2 Structure Inquiry
Get Structure Info
 1	CARD8		opcode (x11 assigned)
 1	33		PEX opcode
 2	2		request length
 4	CARD32		structure ID 

Get Structure Info Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	0		reply length
 2			edit mode
    0 Structure Insert
    1 Structure Replace
 2			unused
 4	CARD32		element ptr
 4	CARD32		num elements
 4	CARD32		length of structure
 4	CARD32		num refs
 4			unused

Get Element Info 
 1	CARD8		opcode (x11 assigned)
 1	34		PEX opcode
 2	6		request length
 4	CARD32		structure ID 
 2	CARD16		whence 1
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 1
 2	CARD16		whence 2
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 2

Get Element Info Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n		Length (not 0)
 4	n		num info
 20			unused
 4n			LISTofELEMENT_INFO

Get Structures In Network
 1	CARD8		opcode (x11 assigned)
 1	35		PEX opcode
 2	3		request length
 4	CARD32		structure ID 
 2			which
    0	Orphans
    1	All
 2			unused

Get Structures In Network Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n		reply length
 4	CARD32		structure ID 
 2			which
    0	Orphans
    1	All
 2			pad
 4 	CARD32		number of structures
 12			unused
 4n			LISTofSTRUCTURE_ID

Get Ancestors
 1	CARD8		opcode (x11 assigned)
 1	36		PEX opcode
 2	4		request length
 4	CARD32		structure ID 
 2			path order
    0	TopFirst
    1	BottomFirst
 2			unused
 4	CARD32		path depth

Get Ancestors Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n+2s		reply length
 4	CARD32		structure ID
 4			path order
    0	TopFirst
    1	BottomFirst
 4	CARD32		path depth
 4	n		number of element ref lists
 8	unused
		    (let s = sum of these n numbers)
 4n+8s			LISTofLISTofELEMENT_REF

Get Descendants
 1	CARD8		opcode (x11 assigned)
 1	37		PEX opcode
 2	4		request length
 4	CARD32		structure ID
 2			path order
    0	TopFirst
    1	BottomFirst
 2			unused
 4	CARD32		path depth

Get Descendants Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n+2s		reply length
 4	CARD32		structure ID
 4			path order
    0	TopFirst
    1	BottomFirst
 4	CARD32		path depth
 4	n		number of element ref lists
 8	unused
		    (let s = sum of these n numbers)
 4n+8s			LISTofLISTofELEMENT_REF

Fetch Elements
 1	CARD8		opcode (x11 assigned)
 1	38		PEX opcode
 2	7		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		Structure ID
 2			whence 1
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 1
 2			whence 2
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 2

Fetch Elements Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	??/4		reply length
 4	CARD32		numElements
 20			pad
 ??			LISTofOUTPUT_COMMAND

7.3 Structure Resource Attribute Modification

Set Editing Mode
 1	CARD8		opcode (x11 assigned)
 1	39		PEX opcode
 2	3		request length
 4	CARD32		Structure ID
 2			mode
    0	structure insert
    1	structure replace
 2			unused

Set Element Pointer
 1	CARD8		opcode (x11 assigned)
 1	40		PEX opcode
 2	4		request length
 4	CARD32		Structure ID
 2			whence
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset


Set Element Pointer At Label
 1	CARD8		opcode (x11 assigned)
 1	41		PEX opcode
 2	4		request length
 4	CARD32		Structure ID
 4	CARD32		label
 4	INT32		offset

Element Search
 1	CARD8		opcode (x11 assigned)
 1	42		PEX opcode
 2	7+(2i+2e+p+p2)/4	request length
 4	CARD32		Structure ID
 2			whence
    0	Beginning
    1	Current
    2	End
 2			unused
 4			offset
 4			direction
    0	Forward
    1	Backward
 4	i		number of elements in incl list
 4	e		number of elements in excl list
 2i			LISTofELEMENT_TYPE (incl)
 p			unused, p = Pad(2i)
 2e			LISTofELEMENT_TYPE (excl)
 p2			unused, p2 = Pad(2e)

Element Search Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	0		reply length
 2			status
    1	NotFound
    2	Found
 2			unused
 4	CARD32		found offset
 16			unused

7.4 Structure Editing

Store Elements
 1	CARD8		opcode (x11 assigned)
 1	43		PEX opcode
 2	4+??/4		request length
 2	INT16		floating point format
 2	INT16		direct color format
 4	CARD32		Structure ID
 4	n		number of output commands
 ??			LISTofOUTPUT_COMMAND

Delete Elements
 1	CARD8		opcode (x11 assigned)
 1	44		PEX opcode
 2	6		request length
 4	CARD32		Structure ID
 2			whence 1
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 1
 2			whence 2
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 2

Delete Elements To Label
 1	CARD8		opcode (x11 assigned)
 1	45		PEX opcode
 2	5		request length
 4	CARD32		Structure ID
 2			whence
    0	Beginning
    1	Current
    2	End
 2			unused
 4			offset
 4	CARD32		label

Delete Elements Between Labels
 1	CARD8		opcode (x11 assigned)
 1	46		PEX opcode
 2	4		request length
 4	CARD32		Structure ID
 4	CARD32		label 1
 4	CARD32		label 2

Copy Elements
 1	CARD8		opcode (x11 assigned)
 1	47		PEX opcode
 2	9		request length
 4	CARD32		source Structure ID
 2			whence 1
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 1
 2			whence 2
    0	Beginning
    1	Current
    2	End
 2			unused
 4	INT32		offset 2
 4	CARD32		destination Structure ID
 2			whence destination
    0	Beginning
    1	Current
    2	End
 2 			unused
 4	INT32		offset destination

Change Structure References
 1	CARD8		opcode (x11 assigned)
 1	48		PEX opcode
 2	3		request length
 4	CARD32		old structure ID
 4	CARD32		new structure ID


SECTION 8. Name Sets


8.1 Name Set Resource Management
Create Name Set
 1	CARD8		opcode (x11 assigned)
 1	49		PEX opcode
 2	2		request length
 4	CARD32		name set ID

Copy Name Set
 1	CARD8		opcode (x11 assigned)
 1	50		PEX opcode
 2	3		request length
 4	CARD32		source name set ID
 4	CARD32		destination name set ID

Free Name Set
 1	CARD8		opcode (x11 assigned)
 1	51		PEX opcode
 2	2		request length
 4	CARD32		name set ID

8.2 Name Set Inquiry

Get Name Set
 1	CARD8		opcode (x11 assigned)
 1	52		PEX opcode
 2	2		request length
 4	CARD32		name set ID

Get Name Set Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n		reply length
 4	n		number of names
 20			unused
 4n			LISTofNAME

8.3 Name Set Modification

Change Name Set
 1	CARD8		opcode (x11 assigned)
 1	53		PEX opcode
 2	3+n		request length
 4	CARD32		name set ID
 2			actions
    0	Add
    1	Remove
    2	Replace
 2	n		number of names
 4n			LISTofNAME


SECTION 9. Search Contexts


SC_BITMASK
    0x0001	search position
    0x0002	search distance
    0x0004	search ceiling
    0x0008	start path
    0x0010	incl list
    0x0020	excl list

 Note that lengths are the (perhaps padded) lengths sent over the wire, and
 are chosen to make entries align. Types may be smaller than the length field
 into which they are assigned. If the natural type is smaller than the padded
 field, this is equivalent to sending the value in its native type and then
 a pad of (length - native size) bytes.
 If a component has sub-fields, the sizes, types and interpretations of the
 sub-fields are on subsequent lines.

 Attribute Name		Length Type		
 search position	12			
		    4	FLOAT	x
		    4	FLOAT	y
		    4	FLOAT	z
 search distance	4	FLOAT		
 search ceiling		4	CARD16		
 start path		4+8n			
		    4	n	length of LIST
		    8n		LISTofELEMENT_REF
 incl list		4+4n			
		    4	n	length of LIST
		    4n		LISTofNAME
 excl list		4+4n			
		    4	n	length of LIST
		    4n		LISTofNAME

9.1 Search Context Resource Management

Create Search Context
 1	CARD8		opcode (x11 assigned)
 1	54		PEX opcode
 2	4+(??+p)/4	request length
 2	INT16		floating point format
 2			unused
 4	CARD32		Search Context ID
 4	SC_BITMASK	item mask
 ??			LISTofVALUE
 p			pad, p= pad(??)

Copy Search Context
 1	CARD8		opcode (x11 assigned)
 1	55		PEX opcode
 2	4		request length
 4	CARD32		source Search Context ID
 4	CARD32		destination Search Context ID
 4	SC_BITMASK	item list

Free Search Context
 1	CARD8		opcode (x11 assigned)
 1	56		PEX opcode
 2	2		request length
 4	CARD32		Search Context ID

9.2 Search Context Inquiry

Get Search Context
 1	CARD8		opcode (x11 assigned)
 1	57		PEX opcode
 2	4		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		Search Context ID
 4	SC_MASK		item mask


Get Search Context Reply
 1	1		reply opcode
 1			item Mask
 2	CARD16		sequence number
 4	(??+p)/4	reply length
 4	CARD32		Search Context ID
 4	n		number of items in reply
 16			pad
 ??			LISTofVALUE
 p			pad, p = pad(??)

9.3 Search Context Modification

Change Search Context
 1	CARD8		opcode (x11 assigned)
 1	58		PEX opcode
 2	4+(??+p)/4	request length
 2	INT16		floating point format
 2			unused
 4	CARD32		Search Context ID
 4	SC_BITMASK	item_mask
 ??			LISTofVALUE
 p			pad, p= pad(??)

9.4 Structure Network Searching

Search Network
 1	CARD8		opcode (x11 assigned)
 1	59		PEX opcode
 2	2		request length
 4	CARD32		Search Context ID

Search Network Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	2n		reply length
 4	CARD32		Search Context ID
 4	n		number of element refs
 16			unused
 8n			LISTofELEMENT_REF


SECTION 10. PHIGS Workstations


10.1 Workstation Resource Management

Create PHIGS WKS
 1	CARD8		opcode (x11 assigned)
 1	60		PEX opcode
 2	18		request length
 4	CARD32		PHIGS WKS ID
 4	CARD32		drawable ID
 4	CARD32		line bundle 
 4	CARD32		marker bundle 
 4	CARD32		text bundle 
 4	CARD32		interior bundle 
 4	CARD32		edge bundle 
 4	CARD32		color table
 4	CARD32		pattern table
 4	CARD32		text font table
 4	CARD32		depth cue table
 4	CARD32		light table
 4	CARD32		color approx table
 4	CARD32		highlight inclusion
 4	CARD32		highlight exclusion
 4	CARD32		invisibility inclusion
 4	CARD32		invisibility exclusion

Free PHIGS WKS
 1	CARD8		opcode (x11 assigned)
 1	61		PEX opcode
 2	2		request length
 4	CARD32		PHIGS WKS ID

10.2 PHIGS Workstation Inquiry

Get PHIGS Workstation Info
 1	CARD8		opcode (x11 assigned)
 1	62		PEX opcode
 2	4		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 4			item mask
    0x00000001	display update
    0x00000002	visual state
    0x00000004	display surface
    0x00000008	view update
    0x00000010	defined views
    0x00000020	wks update
    0x00000040	requested NPC subvolume
    0x00000080	current NPC subvolume
    0x00000100	requested wks viewport
    0x00000200	current wks viewport
    0x00000400	HLHSR update
    0x00000800	requested HLHSR mode
    0x00001000	current HLHSR mode
    0x00002000	drawable ID
    0x00004000	line bundle
    0x00008000	marker bundle
    0x00010000	text bundle
    0x00020000	interior bundle
    0x00040000	edge bundle
    0x00080000	color table
    0x00100000	pattern table
    0x00200000	text font table
    0x00400000	depth cue table
    0x00800000	light table
    0x01000000	color approximation table
    0x02000000	highlight inclusion
    0x04000000	highlight exclusion
    0x08000000	invisibility inclusion
    0x10000000	invisibility exclusion
    0x20000000	posted structures


Get PHIGS Workstation Info Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(??+p)/4	reply length
 4	CARD32		PHIGS WKS ID
 4			item mask (as above)
 4	n		number of values in list
 12			unused
 ??			LISTofVALUE (see below)
 p			pad, p = pad(??)

 Note that lengths are the (perhaps padded) lengths sent over the wire, and
 are chosen to make entries align. Types may be smaller than the length field
 into which they are assigned. If the natural type is smaller than the padded
 field, this is equivalent to sending the value in its native type and then
 a pad of (length - native size) bytes.
 If a component has sub-fields, the sizes, types and interpretations of the
 sub-fields are on subsequent lines.

 Attribute Name		Length	Type		
 display update		4	INT16		
 visual state		4			
			    0	Correct
			    1	Deferred
			    2	Simulated
 display surface	4			
			    0	Empty
			    1	Not Empty
 view update		4			
			    0	NotPending
			    1	Pending
 defined views		4+4n			
		    4	n		length
		    4n			LISTofTABLE_INDEX
 wks update		4			
			    0	NotPending
			    1	Pending
 requested NPC subvol.	24			
		    4	FLOAT		x min
		    4	FLOAT		y min
		    4	FLOAT		z min
		    4	FLOAT		x max
		    4	FLOAT		y max
		    4	FLOAT		z max
 current NPC subvolume	24		 	
		    4	FLOAT		x min
		    4	FLOAT		y min
		    4	FLOAT		z min
		    4	FLOAT		x max
		    4	FLOAT		y max
		    4	FLOAT		z max
 requested wks viewport 20
		    8 	DrawableCoord	min
		    8	DrawableCoord	max
		    2	boolean		use drawable
			0	false
			1	true
		    2	pad	
 current wks viewport	20
		    8 	DrawableCoord	min
		    8	DrawableCoord	max
		    2	boolean		use drawable
			0	false
			1	true
		    2	pad	
		
 hlhsr update		4
		    0	Not Pending
		    1	Pending
 requested hlhsr mode 	4	INT16
 current hlhsr mode 	4	INT16
 drawable ID		4	CARD32		
 line bundle		4	CARD32		
 marker bundle		4	CARD32	
 text bundle		4	CARD32		
 interior bundle	4	CARD32		
 edge bundle		4	CARD32		
 color table		4	CARD32		
 pattern table		4	CARD32		
 text font table	4	CARD32		
 depth cue table	4	CARD32		
 light table		4	CARD32		
 color approx. table	4	CARD32		
 highlight inclusion	4	CARD32		
 highlight exclusion	4	CARD32		
 invisibility inclusion	4	CARD32		
 invisibility exclusion	4	CARD32		
 posted structures	4+4n			
		    4	n		length of list
		    4n			LISTofSTRUCTURE_ID

Get Dynamics
 1	CARD8		opcode (x11 assigned)
 1	63		PEX opcode
 2	2		request length
 4	CARD32		Drawable ID


The following constants are used for the reply fields below:
    0	IMM
    1	IRG
    2	CBS

Get Dynamics Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	0		reply length
 1			view rep
 1			line bundle
 1			marker bundle
 1			text bundle
 1			interior bundle
 1			edge bundle
 1			pattern table
 1			color table
 1			wks transform
 1			highlight filter
 1			invisibility filter
 1			HLHSR mode
 1			structure modify
 1			post structure
 1			unpost structure
 1			delete structure
 1			reference modify
 7			unused

Get View Representation
 1	CARD8		opcode (x11 assigned)
 1	64		PEX opcode
 2	4		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 2	CARD16		Table index
 2			unused

Get View Representation Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	80		reply length
 2			view Update
    0	NotPending
    1	Pending
 22			unused
 2	CARD16		table index requested
 2			unused
 2			clipping requested 
    0x0001		clip xy  requested
    0x0002		clip back requested
    0x0004		clip front requested
 2			unused
 4	FLOAT		x min clip limits requested
 4	FLOAT		y min clip limits requested
 4	FLOAT		z min clip limits requested
 4	FLOAT		x max clip limits requested
 4	FLOAT		y max clip limits requested
 4	FLOAT		z max clip limits requested
 64	FLOAT[4][4]	orientation requested
 64	FLOAT[4][4]	mapping requested
 2	CARD16		table index current
 2			unused
 2			clipping current 
    0x0001		clip xy  current
    0x0002		clip back current
    0x0004		clip front current
 2			unused
 4	FLOAT		x min clip limits current
 4	FLOAT		y min clip limits current
 4	FLOAT		z min clip limits current
 4	FLOAT		x max clip limits current
 4	FLOAT		y max clip limits current
 4	FLOAT		z max clip limits current
 64	FLOAT[4][4]	orientation current
 64	FLOAT[4][4]	mapping current

 10.3 PHIGS Workstation Manipulation

Redraw All Structures
 1	CARD8		opcode (x11 assigned)
 1	65		PEX opcode
 2	2		request length
 4	CARD32		PHIGS WKS ID

Update Workstation
 1	CARD8		opcode (x11 assigned)
 1	66		PEX opcode
 2	2		request length
 4	CARD32		PHIGS WKS ID

Execute Deferred Actions
 1	CARD8		opcode (x11 assigned)
 1	67		PEX opcode
 2	2		request length
 4	CARD32		PHIGS WKS ID

Set View Priority
 1	CARD8		opcode (x11 assigned)
 1	68		PEX opcode
 2	4		request length
 4	CARD32		PHIGS WKS ID
 2	CARD16		index 1
 2	CARD16		index 2
 2			priority
    0	Higher
    1	Lower
 2			unused

Set Display Update Mode
 1	CARD8		opcode (x11 assigned)
 1	69		PEX opcode
 2	3		request length
 4	CARD32		PHIGS WKS ID
 2	INT16		display update
 2			unused

Map DC to WC
 1	CARD8		opcode (x11 assigned)
 1	70		PEX opcode
 2	4+2n		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 4	n		number of coords
 8n			LISTofDRAWABLE_COORD

Map DC to WC Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	3n		reply length
 2	CARD16		view index
 2			unused
 4	n		number coords being returned
 16			unused
 12n			LISTofCOORD_3D

Map WC to DC
 1	CARD8		opcode (x11 assigned)
 1	71		PEX opcode
 2	4+3n		request length
 2	INT16		floating point format
 2	CARD16		table index
 4	CARD32		PHIGS WKS ID
 4	n		number of coords
 12n			LISTofCOORD_3D

Map WC to DC Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	2n		reply length
 2	CARD16		view index
 2			unused
 4	n		number coords being returned
 16			unused
 8n			LISTofDRAWABLE_COORD

 10.4 PHIGS Workstation Update Requests

Set View Rep
 1	CARD8		opcode (x11 assigned)
 1	72		PEX opcode
 2	43		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 2	CARD16		table index 
 2			pad
 2			clip limits  
    0x0001		clip xy  requested
    0x0002		clip back requested
    0x0004		clip front requested
 2			pad
 4	FLOAT		x min clip limits 
 4	FLOAT		y min clip limits 
 4	FLOAT		z min clip limits 
 4	FLOAT		x max clip limits 
 4	FLOAT		y max clip limits 
 4	FLOAT		z max clip limits 
 64	FLOAT[4][4]	orientation 
 64	FLOAT[4][4]	mapping 

Set Workstation Window
 1	CARD8		opcode (x11 assigned)
 1	73		PEX opcode
 2	9		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 4	FLOAT		x min 
 4	FLOAT		y min 
 4	FLOAT		z min
 4	FLOAT		x max
 4	FLOAT		y max
 4	FLOAT		z max

Set Workstation Viewport
 1	CARD8		opcode (x11 assigned)
 1	74		PEX opcode
 2	8		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 2	CARD16		x min
 2	CARD16		y min
 4	FLOAT		z min
 2	CARD16		x max
 2	CARD16		y max
 4	FLOAT		z max
 2	CARD16		use drawable
	0	No
	1	Yes
 2			unused

Set HLHSR Mode
 1	CARD8		opcode (x11 assigned)
 1	75		PEX opcode
 2	3		request length
 4	CARD32		PHIGS WKS ID
 2	INT16		mode
 2			unused

 10.5 Posting/Unposting Structures

Post Structure
 1	CARD8		opcode (x11 assigned)
 1	76		PEX opcode
 2	4		request length
 4	CARD32		PHIGS WKS ID
 4	CARD32		structure ID
 4	CARD32		priority

Unpost Structure
 1	CARD8		opcode (x11 assigned)
 1	77		PEX opcode
 2	3		request length
 4	CARD32		PHIGS WKS ID
 4	CARD32		structure ID

Unpost All Structures
 1	CARD8		opcode (x11 assigned)
 1	78		PEX opcode
 2	2		request length
 4	CARD32		PHIGS WKS ID

Get PHIGS Workstation Postings
 1	CARD8		opcode (x11 assigned)
 1	79		PEX opcode
 2	2		request length
 4	CARD32		structure ID

Get PHIGS Workstation Postings Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	n		reply length
 24			unused
 4n			LISTofPHIGS_WKS_ID



SECTION 11. Picking


P_BITMASK
    0x0001	pick status
    0x0002	pick element refs
    0x0004	pick path order
    0x0008	pick inclusion
    0x0010	pick exclusion
    0x0020	pick data rec
    0x0040	prompt echo type
    0x0080	echo volume
    0x0100	echo switch

 Note that lengths are the (perhaps padded) lengths sent over the wire, and
 are chosen to make entries align. Types may be smaller than the length field
 into which they are assigned. If the natural type is smaller than the padded
 field, this is equivalent to sending the value in its native type and then
 a pad of (length - native size) bytes.
 If a component has sub-fields, the sizes, types and interpretations of the
 sub-fields are on subsequent lines.

 Attribute Name		Length	Type
 pick status		4			
			    0	NoPick
			    1	Ok
 pick path		4+12n	LISTofPICK_ELEMENT_REF
 pick path order	4			
			    0	TopFirst
			    1	BottomFirst
 pick inclusion		4	CARD32		
 pick exclusion		4	CARD32		
 pick data rec		4+n+p			
		    	4	n		length
		    n			LISTofCARD8
		    p			pad, p=pad(n)
 prompt echo type	4	INT16		
 echo volume		16			
		    2	CARD16		x min
		    2	CARD16		y min
		    4	FLOAT		z min
		    2	CARD16		x max
		    2	CARD16		y max
		    4	FLOAT		z max
		    4	INT16		use drawables
			0	No
			1	Yes
 echo switch		4			
			    0	NoEcho
			    1	Echo


11.1 Pick Device Descriptors

Get Pick Device
 1	CARD8		opcode (x11 assigned)
 1	80		PEX opcode
 2	5		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 2	INT16		dev type
 2			unused
 4	P_BITMASK	item mask

Get Pick Device Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(??+p)/4	reply length
 4	P_BITMASK	item mask
 4	n		number of items in list
 16			unused
 ??			LISTofVALUE
 p			pad, p=pad(??)

Change Pick Device
 1	CARD8		opcode (x11 assigned)
 1	81		PEX opcode
 2	5+(??+p)/4	request length
 2	CARD16		floating point format
 2			unused
 4	CARD32		PHIGS WKS ID
 2	INT16		dev type
 2			unused
 4	P_BITMASK	item mask
 ??			LISTofVALUE
 p			pad, p=pad(??)

11.2 Pick Measure Resource Management

Create Pick Measure
 1	CARD8		opcode (x11 assigned)
 1	82		PEX opcode
 2	4		request length
 4	CARD32		PHIGS WKS ID
 4	CARD32		Pick Measure ID
 2	INT16		dev type
 2			unused

Free Pick Measure
 1	CARD8		opcode (x11 assigned)
 1	83		PEX opcode
 2	2		request length
 4	CARD32		Pick Measure ID

11.3 Pick Measure Inquiry

PM_BITMASK
    0x0001	pick status
    0x0002	pick prim

 Note that lengths are the (perhaps padded) lengths sent over the wire, and
 are chosen to make entries align. Types may be smaller than the length field
 into which they are assigned. If the natural type is smaller than the padded
 field, this is equivalent to sending the value in its native type and then
 a pad of (length - native size) bytes.
 If a component has sub-fields, the sizes, types and interpretations of the
 sub-fields are on subsequent lines.


 Attribute Name		Length	Type
 pick status		4	CARD16
			0 NoPick
			1 Ok
 num pick element refs	4	n	CARD32
 pick element refs	12n	LISTofPICK_ELEMENT_REF

Get Pick Measure Attributes
 1	CARD8		opcode (x11 assigned)
 1	84		PEX opcode
 2	3		request length
 4	CARD32		Pick Measure ID
 4	PM_BITMASK	item mask

Get Pick Measure Attributes Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	(??+p)/4	reply length
 4			item mask
 4 	CARD32		number of items
 16			unused
 ??			LISTofVALUE
 p			pad, p=pad(??)


11.4 Pick Operations

Update Pick Measure
 1	CARD8		opcode (x11 assigned)
 1	85		PEX opcode
 2	3+(n+p)/4	request length
 4	CARD32		pick measure ID
 4	n		length of list
 n			LISTofCARD8
 p			pad, p=pad(n)


SECTION 12. Font Requests


12.1 Font Resource Management

Open Font
 1	CARD8		opcode (x11 assigned)
 1	86		PEX opcode
 2	3+(n+p)/4	request length
 4	CARD32		font ID
 4	n		length of name
 n			LISTofCARD8
 p			pad, p=pad(n)

Close Font
 1	CARD8		opcode (x11 assigned)
 1	87		PEX opcode
 2	2		length
 4	CARD32		font ID

Query Font
 1	CARD8		opcode (x11 assigned)
 1	88		PEX opcode
 2	3		request length
 2	INT16		floating point format
 2			unused
 4	CARD32		font ID

Query Font Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	f/4+5n		reply length
 4	f		length of font info
 4	n		number of entries in list of charinfo
 16			unused
 f			font info
 20n			LISTofPEX_CHARINFO

List Fonts 
 1	CARD8		opcode (x11 assigned)
 1	89		PEX opcode
 2	2+(n+p)/4	request length
 2	CARD16		max names
 2	n		number of characters in pattern
 n			LISTofCARD8
 p			pad, p=pad(n)

List Fonts Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	??/4		reply length
 4	CARD32		number of STRINGs in list
 20			unused
 ??			LISTofSTRING

List Fonts With Info
 1	CARD8		opcode (x11 assigned)
 1	90		PEX opcode
 2	3+(n+p)/4	request length
 2	INT16		floating point format
 2	CARD16		max names
 2	n		length of pattern
 2			unused
 n			LISTofCARD8
 p			pad, p=pad(n)

List Fonts With Info Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	1+(??1+??2)/4	reply length
 4	s		number of STRINGs in list
 20			unused
 ??1			LISTofSTRING
 4	i		number of PEX_FONTINFO in list
 ??2			LISTofPEX_FONTINFO

Query Text Extents
 1	CARD8		opcode (x11 assigned)
 1	91		PEX opcode
 2	5+(n+p)/4	request length
 2	INT16		floating point format
 2			unused 
 4	CARD32		Font ID
 4	CARD32		Pipeline Context ID
 4	n		length of string
 n			LISTofCARD8
 p			pad, p=pad(n)

 Note that the Query Text Extents reply is a normal 32-byte reply invariably
 followed by 4 bytes of overall width.  It almost fit. 
Query Text Extents Reply
 1	1		reply opcode
 1			unused
 2	CARD16		sequence number
 4	1		reply length
 4	FLOAT		overall ascent
 4	FLOAT		overall descent
 4	FLOAT		overall left
 4	FLOAT		overall right
 8	COORD-2D	concat point
 	4	FLOAT		x 
 	4	FLOAT		y 
 4	FLOAT		overall width

