*************************************************************************
* >E-Vars	Documents the variable numbers used by Zap_ReadVar	*
*************************************************************************

This documents the variable numbers used by the Zap_ReadVar and Zap_WriteVar
calls. It also documents the Config file format. Please note that the
variables with names beginning 'opt_' are stored in the !Config file and thus
saved when the user clicks 'Options.Save'.

The options for a given mode are also stored in the !Config file. See below.

Number:	Variable name:	Contents:

0	scn_xos		Screen horizontal size (in os coords)
1	scn_yos		Screen vertical size (in os coords)
2	opt_flags	Config file flags word  (see E-Flags)
3	opt_format	Config file format word (see E-Format)
4	wimp_task	Zaps task handle
5	car_cursor	Cursor caret block pointer (see E-Cursors)
6	car_input	Input caret block pointer (see E-Cursors)
7	car_selection	Selection caret block pointer (see E-Cursors)
8	wind_num	Number of window blocks (see E-Windows)
9	file_num	Number of file blocks (see E-File)
10	car_mode	Current cursor editing mode (see E-Cursors)
11	wimp_version	Version number Zap logged on as (200/300/350)
12	key_default	Default key map number
13	key_basemap	Basemap number
14	key_last	Zap key code of last key processed
15	key_lastcom	Address of last key command executed
16	mini_ptr	Address of minibuffer
17	mini_bufl	Size of minibuffer
18	mini_len	Size of data in minibuffer
19	mini_off	Offset of cursor in minibuffer
20	mini_mark	Offset of mark in minibuffer (see Zap_MiniWrite)
21	yank_ptr	Address of kill ring buffer
22	yank_len	Size of data in kill ring buffer
23	key_current	Current keymap number
24	reserved	(was control character set number)
25	opt_tab		Default column tab for windows.
26	opt_addr	Default address of first byte of file.
27	opt_stline	Default number of first line of file.
28	opt_linesp	Default line spacing in 1/8ths char.
29	env_start	Bottom of Zaps stack (&8000 except in test modes)
30	env_top		Start of free memory.
31	wimp_iconbar	Handle of iconbar icon.
32	wimp_timeformat	Standard time format string.
33	wimp_dateformat	Standard date format string.

Setting & Reading default mode options
--------------------------------------

Each mode has a word of workspace in a window block called w_moden (see
E-Windows). When a window is created, the default settings (stored in the
!Config file) for that mode is used. These default settings are stored in
memory, and saved when the user clicks on the 'save options' menu entry.
The variable number &100+n accesses the default mode word for mode numbered
n. Ie,

&100	opt_mode0	Text mode word
&101	opt_mode1	Byte mode word
&102	opt_mode2	Word mode word
... etc ...

If there was no information about the mode in the !Config file then the mode
word is set to 0. In this case, the mode should note this on startup (see
e_init with R1=2) and write some sensible default values to it. If the mode
has b10 set in it's e_mode word, then the mode word points to a block of
data, the first word in the block giving the total length of the block. The
mode can resize this block at any time using the standard heap calls. If the
mode word was 0 then the mode should claim a block at startup and set it up
with default values (and save the address of it's block in the mode word via
Zap_WriteVar).

If your mode word is zero when you start up then you should also define
sensible colours for your mode using Zap_ModeColours and a sensible width etc
using Zap_ModeData.

!Config file format (Version 1.10+)
-----------------------------------

The first word must be the bytes for the letters "Conf". Then the !Config
file consists of a list of blocks, terminated by a zero word. Each block has
the following format:

 #0	Block type:	0	End of list.
 			1	Zap global options storage block.
 			2	Mode dependant storage block.
 			3+	Reserved
 #4	Total block length (offset from start of block to next block).
 #8 ...	Block data
 
Block type 1 is version dependent (see below).

If the block type is 2 then the block data has the following format

	#0	Mode name, zero terminated then align to next word.
		Length of Zap handled data for this mode (see below)
		Zap handled data for this mode (version dependant)
		Length of Mode handled data for this mode (0 if none).
		Mode handled data for the mode (mode dependant).

(NB If b10 of e_mode is set then the last two entries are written into a heap
block whose address is stored in opt_moden where n is the mode number which
is assigned to the mode. If not, the the first word of the data is put
in opt_moden)

Version 1.10
------------

The format of the Zap handled bits for version 1.1 is:

Block type 1 data: (total block length 8+&54=&5C)

		#&00	Reserved (set to 0)
                #&04	Reserved
                #&08	Reserved
                #&0C	Reserved
                #&10	Reserved
                #&14	character set to use for control characters (0-3)
		#&18	column tab width
		#&1C	opt_flags value (see E-Flags)
		#&20	opt_format value (see E-Flags)
		#&24	address of first byte of file (for line numbers)
		#&28	line number of first line of file
		#&2C	line spacing
		#&30	margin width
		#&34	cursor types byte0=normal cursor byte1=split1 cursor
			byte2=split2 cursor byte3=mark position cursor.
			0=block 1=square 2=underscore 3=bar 4=none
			5+=undefined
		#&38	Code of end of line x4 (eg &0a0a0a0a)
		#&3C	Code of tab character x4 (eg &09090909)
		#&40	Wordwrap width
		#&44	Minibuffer colours byte0=background wimp col
			byte1=foreground wimp colour
		#&48	Switches flags word:
			b0 set for flashing cursor
			b1 must be 0
			b2 set for date checking on file saving
			b3 set for clear search window automatically
			b4 must be 0
			b5 must be 0
			b6 set for confine cursor to window
			b7 must be 0
			b8-b31 reserved - must be 0
		#&4C	Reserved
		#&50	Reserved
		
Block type 2 data:

The Zap handled bit of it is 12 bytes long and documented below. The format
may change with future versions and should be read via Zap calls
Zap_ModeColour and Zap_ModeData if you are a Zap extension mode.

	#0	Mode data variable 0 - see Zap_ModeData call.
	#4 &#8	The current palette for this mode. The 16 nibbles give
		the wimp colours of the 16 colours with nibble0=background
		colour 1, nibble1=background colour 2 etc.
		See Zap_ModeColour.

Version 1.20
------------

Block type 1 data:

The block has the same length and general format but the following offsets
are changed.

	#&44 Reserved - should be set to 0. (if non zero then old format)
	#&4C Minibuffer background palette entry word.
	#&50 Minibuffer foreground palette entry word.

Block type 2 data:

The Zap handled bit is now of variable length and of the format:

	#0	Mode data variable 0 - see Zap_ModeData
	#4	Mode data variable 1
		...
		-1 (to terminate mode data variable list)
		Colour 0 (24 bit of form &BBGGRRZZ where ZZ is the Zap)
		Colour 1 (style - &10 is default)
		Colour 2
		... until end of block (length of block determines number
		    of colours).

Version 1.30
------------

Block type 1 data:

The following changes have been made:
	#&14	Now reserved, no longer the control character set.
