#define typ_end 0
#define typ_val 1
#define typ_val2 2
#define typ_str 3
#define typ_switch 4
#define typ_color 5
#define typ_fill 6
#define typ_marker 7
#define typ_lstyle 8
#define typ_justify 9
#define typ_arrow 10

/* pos=   Offset to find the data			*/
/* idx=   For switches, which can only have one value. 	*/
/* The pos is the order the items will be placed in the pcode */
/*
/* Switches 	LONG 	placed in directly, 1 present, 0 not present
/* expressions 	LONG* 	pointed to, 0 if not present.
/* color/fill	LONG* 	Pointer to exp 0 if not present.
/* marker	LONG*	Pointer to exp 0 if not present.
/* lstyle 	LONG*	Pointer to exp 0 if not present.
/* font 	int32* 	Pointer to string expression.
*/
/*---------------------------------------------------------------------------*/

char *zzzmainkey[] = {
"","ALINE", "RLINE", "AMOVE", "RMOVE", "BOX"
, "BEGIN" , "CIRCLE", "FOR", "NEXT", "SET"
, "BEZIER", "RBEZIER", "ARCTO", "ARC", "NARC"
, "CURV", "PIE", "MARKER", "TEXT", "END"
, "IF", "ELSE", "GOTO", "GSAVE", "DEFINE"
, "REGION", "UNTIL", "WHILE", "WRITE", "SUB"
, "DFONT", "CLOSEPATH", "NEWPATH", "SCALE", "ROTATE"
, "TRANSLATE", "ICON" , "INCLUDE", "JOIN", "SAVE"
, "MOVE", "REVERSE", "FILL", "STROKE", "FOPEN"
, "FCLOSE", "INPUT", "PRINT", "LET" };


struct op_key op_box[] = {
		 "JUSTIFY", 	typ_justify, 	1, 0
		,"JUST", 	typ_justify, 	1, 0
		,"NOSTROKE", 	typ_switch, 	2, 1
		,"NOBORDER", 	typ_switch, 	2, 1
		,"NOBOX", 	typ_switch, 	2, 1
		,"FILL", 	typ_fill, 	3, 0
		,"NAME", 	typ_str, 	4, 0
		,"END", 	typ_end, 	0, 0  };
struct op_key op_circle[] = {
		 "JUSTIFY", 	typ_justify, 	1, 0
		,"JUST", 	typ_justify, 	1, 0
		,"NOSTROKE", 	typ_switch, 	2, 1
		,"FILL", 	typ_fill, 	3, 0
		,"NAME", 	typ_str, 	4, 0
		,"END", 	typ_end, 	0, 0  };
struct op_key op_fill[] = {
		 "FILL", 	typ_fill, 	1, 0
		,"END", 	typ_end, 	0, 0  };
struct op_key op_for_step[] = {
		 "STEP", 	typ_val, 	1, 0
		,"END", 	typ_end, 	0, 0  };
struct op_key op_begin_text[] = {
		 "WIDTH", 	typ_val, 	1, 0
		,"DEPTH", 	typ_val, 	2, 0
		,"END", 	typ_end, 	0, 0  };

/* JUSTIFY:  stored as a int32 word string. 'LEFT', 'CENT', 'RIGH', 'LT' */
struct op_key op_justify[] = {
		 "LEFT", 	typ_switch, 	1, 0x100
		,"CENT", 	typ_switch, 	1, 0x110
		,"CENTER", 	typ_switch, 	1, 0x110
		,"CENTRE", 	typ_switch, 	1, 0x110
		,"RIGHT", 	typ_switch, 	1, 0x120
		,"LT",	 	typ_switch, 	1, 0x02
		,"TL",	 	typ_switch, 	1, 0x02
		,"CL",	 	typ_switch, 	1, 0x01
		,"LC",	 	typ_switch, 	1, 0x01
		,"BL",	 	typ_switch, 	1, 0x00
		,"LB",	 	typ_switch, 	1, 0x00
		,"CB",	 	typ_switch, 	1, 0x10
		,"BC",	 	typ_switch, 	1, 0x10
		,"RB",	 	typ_switch, 	1, 0x20
		,"BR",	 	typ_switch, 	1, 0x20
		,"CR",	 	typ_switch, 	1, 0x21
		,"RC",	 	typ_switch, 	1, 0x21
		,"TR",	 	typ_switch, 	1, 0x22
		,"RT",	 	typ_switch, 	1, 0x22
		,"TC",	 	typ_switch, 	1, 0x12
		,"CT",	 	typ_switch, 	1, 0x12
		,"CC",	 	typ_switch, 	1, 0x11
		,"CI",	 	typ_switch, 	1, 0x1011
		,"C",	 	typ_switch, 	1, 0x1011
		,"VI",	 	typ_switch, 	1, 0x2000
		,"V",	 	typ_switch, 	1, 0x2000
		,"HO",	 	typ_switch, 	1, 0x3000
		,"H",	 	typ_switch, 	1, 0x3000
		,"BOX",	 	typ_switch, 	1, 0x5011
		,"BO",	 	typ_switch, 	1, 0x5011
		,"END", 	typ_end, 	1, 1 };
struct op_key op_begin[] = {
		 "PATH", 	typ_switch, 	1, 1
		,"BOX", 	typ_switch, 	1, 2
		,"SCALE", 	typ_switch, 	1, 3
		,"ROTATE", 	typ_switch, 	1, 4
		,"TRANSLATE", 	typ_switch, 	1, 5
		,"ROT", 	typ_switch, 	1, 4
		,"TRAN", 	typ_switch, 	1, 5
		,"IF", 		typ_switch, 	1, 6
		,"SUB", 	typ_switch, 	1, 7
		,"NAME", 	typ_switch, 	1, 8
		,"TEXT", 	typ_switch, 	1, 9
		,"GRAPH", 	typ_switch, 	1, 10
		,"XAXIS", 	typ_switch, 	1, 11
		,"YAXIS", 	typ_switch, 	1, 12
		,"X2AXIS", 	typ_switch, 	1, 13
		,"Y2AXIS", 	typ_switch, 	1, 14
		,"CURVE",	typ_switch,	1,15
		,"KEY",		typ_switch,	1,16
		,"ORIGIN",	typ_switch,	1,17
		,"TABLE",	typ_switch,	1,18
		,"CLIP",	typ_switch,	1,19
		,"END", 	typ_end, 	1, 1 };
struct op_key op_set[] = {
		 "HEI", 	typ_switch, 	1, 1
		,"FONT", 	typ_switch, 	1, 2
		,"JUSTIFY", 	typ_switch, 	1, 3
		,"JUST", 	typ_switch, 	1, 3
		,"COLOR", 	typ_switch, 	1, 4
		,"DASHLEN", 	typ_switch, 	1, 5
		,"DASH", 	typ_switch, 	1, 6
		,"LDIST", 	typ_switch, 	1, 5
		,"LSTYLE", 	typ_switch, 	1, 6
		,"LWIDTH", 	typ_switch, 	1, 7
		,"JOIN", 	typ_switch, 	1, 8
		,"CAP", 	typ_switch, 	1, 9
		,"FONTLWIDTH", 	typ_switch, 	1, 10
		,"END", 	typ_end, 	1, 1 };
/* colors, fills,  First byte is pattern, then red,green,blue intensities*/
/* currently defined patterns are,  ff=clear, 1=black,  */
struct op_key op_color_typ[] = {
		 "CLEAR", 	typ_switch, 	1, 0XFF000000
		,"BLACK", 	typ_switch, 	1, 0X01000000
		,"WHITE", 	typ_switch, 	1, 0X01FFFFFF
		,"RED", 	typ_switch, 	1, 0X01FF0000
		,"GREEN", 	typ_switch, 	1, 0X0100FF00
		,"BLUE", 	typ_switch, 	1, 0X010000FF
		,"MAGENTA", 	typ_switch, 	1, 0X01FFFF00
		,"YELLOW", 	typ_switch, 	1, 0X0100FFFF
		,"GREY", 	typ_switch, 	1, 0X017F7F7F
		,"GREY90", 	typ_switch, 	1, 0X01060606
		,"GREY80", 	typ_switch, 	1, 0X01191919
		,"GREY70", 	typ_switch, 	1, 0X01323232
		,"GREY60", 	typ_switch, 	1, 0X014b4b4b
		,"GREY50", 	typ_switch, 	1, 0X01646464
		,"GREY40", 	typ_switch, 	1, 0X017d7d7d
		,"GREY30", 	typ_switch, 	1, 0X01969696
		,"GREY20", 	typ_switch, 	1, 0X01afafaf
		,"GREY10", 	typ_switch, 	1, 0X01c8c8c8
		,"GREY5", 	typ_switch, 	1, 0X01f0f0f0
		,"GREY1", 	typ_switch, 	1, 0X01fdfdfd
		,"GRID", 	typ_switch, 	1, 0X02002020
		,"GRID1", 	typ_switch, 	1, 0X02040f0f
		,"GRID2", 	typ_switch, 	1, 0X02001010
		,"GRID3", 	typ_switch, 	1, 0X02052020
		,"GRID4", 	typ_switch, 	1, 0X02104040
		,"GRID5", 	typ_switch, 	1, 0X02206060
		,"SHADE", 	typ_switch, 	1, 0X02000020
		,"SHADE1", 	typ_switch, 	1, 0X0204000C
		,"SHADE2", 	typ_switch, 	1, 0X02000010
		,"SHADE3", 	typ_switch, 	1, 0X02050020
		,"SHADE4", 	typ_switch, 	1, 0X02100040
		,"SHADE5", 	typ_switch, 	1, 0X02200060
		,"RSHADE", 	typ_switch, 	1, 0X02002000
		,"RSHADE1", 	typ_switch, 	1, 0X02040C00
		,"RSHADE2", 	typ_switch, 	1, 0X02001000
		,"RSHADE3", 	typ_switch, 	1, 0X02052000
		,"RSHADE4", 	typ_switch, 	1, 0X02104000
		,"RSHADE5", 	typ_switch, 	1, 0X02206000
		,"END", 	typ_end, 	1, 1 };
struct op_key op_marker[] = {
		"DOT", 	typ_switch, 	1, 1
		,"CROSS", 	typ_switch, 	1, 2
		,"FCIRCLE", 	typ_switch, 	1, 3
		,"FSQUARE", 	typ_switch, 	1, 4
		,"FTRIANGLE", 	typ_switch, 	1, 5
		,"FDIAMOND", 	typ_switch, 	1, 6
		,"CIRCLE", 	typ_switch, 	1, 7
		,"SQUARE", 	typ_switch, 	1, 8
		,"TRIANGLE", 	typ_switch, 	1, 9
		,"DIAMOND", 	typ_switch, 	1, 10
		,"PLUS", 	typ_switch, 	1, 11
		,"CLUB", 	typ_switch, 	1, 12
		,"HEART", 	typ_switch, 	1, 13
		,"DIAMOND", 	typ_switch, 	1, 14
		,"SPADE", 	typ_switch, 	1, 15
		,"STAR", 	typ_switch, 	1, 16
		,"SNAKE", 	typ_switch, 	1, 17
		,"DAG", 	typ_switch, 	1, 18
		,"DDAG", 	typ_switch, 	1, 19
		,"ASTERIX", 	typ_switch, 	1, 20
		,"OPLUS", 	typ_switch, 	1, 21
		,"OMINUS", 	typ_switch, 	1, 22
		,"OTIMES", 	typ_switch, 	1, 23
		,"ODOT", 	typ_switch, 	1, 24
		,"TRIANGLEZ", 	typ_switch, 	1, 25
		,"DIAMONDZ", 	typ_switch, 	1, 26
		,"WCIRCLE", 	typ_switch, 	1, 27
		,"WTRIANGLE", 	typ_switch, 	1, 28
		,"WSQUARE", 	typ_switch, 	1, 29
		,"WDIAMOND", 	typ_switch, 	1, 30
		,"END", 	typ_end, 	1, 1 };

struct op_key op_begin_path[] = {
		 "STROKE", 	typ_switch, 	1, 1
		,"FILL", 	typ_fill, 	2, 0
		,"CLIP", 	typ_switch, 	3, 1
		,"END", 	typ_end, 	0, 0 };
struct op_key op_begin_box[] = {
		 "ADD", 	typ_val, 	1, 0
		,"FILL", 	typ_fill, 	2, 0
		,"NOSTROKE", 	typ_switch, 	3, 1
		,"NOBORDER", 	typ_switch, 	3, 1
		,"NOBOX", 	typ_switch, 	3, 1
		,"NAME", 	typ_str, 	4, 0
		,"END", 	typ_end, 	0, 0 };
struct op_key op_begin_scale[] = {
		 "TRANSLATE", 	typ_val2, 	1, 0
		,"TRAN", 	typ_val2, 	1, 0
		,"SCALE", 	typ_val2, 	3, 0
		,"ROTATE", 	typ_val, 	5, 0
		,"ROT", 	typ_val, 	5, 0
		,"END", 	typ_end, 	0, 0 };
struct op_key op_arrow[] = {
		 "START", 	typ_switch, 	1, 1
		,"END", 	typ_switch, 	1, 2
		,"BOTH", 	typ_switch, 	1, 3
		,"END", 	typ_end, 	0, 0 };
struct op_key op_joinname[] = {
		 "->",	 	typ_switch, 	1, 1
		,"<-",	 	typ_switch, 	1, 2
		,"<->", 	typ_switch, 	1, 3
		,"-", 		typ_switch, 	1, 4
		,"END", 	typ_end, 	0, 0 };
struct op_key op_line[] = {
		 "ARROW", 	typ_arrow, 	1, 1
		,"END", 	typ_end, 	0, 0 };
struct op_key op_size[] = {
		 "BOX", 	typ_switch, 	1, 1
		,"END", 	typ_end, 	0, 0 };

struct op_key op_join[] = {
		 "MITRE", 	typ_switch, 	1, 0
		,"ROUND", 	typ_switch, 	1, 1
		,"BEVEL", 	typ_switch, 	1, 2
		,"END", 	typ_end, 	0, 0 };
struct op_key op_cap[] = {
		 "BUTT", 	typ_switch, 	1, 0
		,"ROUND", 	typ_switch, 	1, 1
		,"SQUARE", 	typ_switch, 	1, 2
		,"END", 	typ_end, 	0, 0 };














                                                                                                                       
