Data structures
===============

Interface (data accessible to both BASIC and assembler code):
                0  = heap page size
                4  = start address of heap
                8  = current size of heap
               12 = front end messages file descriptor
               16 -> 256 byte buffer
               20 = mask for polling WIMP
               24 -> current PRNT structure
               28 -> current QUEU structure
               32 = count of entries in queue
               36 = whether current file is temporary
               40 = handle for queue window
               44 = count of active printers
               48 -> first installed PRNT
               52 -> icon definition for queue window column 0
               56 -> icon definition for queue window column 1
               60 -> icon definition for queue window column 2
               64 -> icon definition for queue window column 3
               68 -> icon definition for queue window column 4
               72 -> icon definition for queue window column 5
               76 = buffer no to use for serial output (3 or 2)
               80 = buffer no to use for parallel output (3 or 10)


Template chain: 0  - ptr to next template (TMPT)
 TMPT           4  - ptr to definition of this template (NTRY)
                8  - size required to data table for this template
               12+ - name of this template

Template entry: 0  - ptr to next template entry (NTRY)
 NTRY           4  - variable type for this entry: 1 - integer
                                                   2 - CR terminated string
                                                   3 - NULL terminated string
                                                   4 - GSTrans string
                                                   5 - boolean
                                                   6 - list
                                                   7 - pointer
                                                   8 - CHAR type
                8  - if boolean, variable type for boolean
                     if list, ptr to list template entry (LIST)
               12  - size of list or char entry
               16+ - name of entry

List template:  0  - ptr to next list entry (LIST)
 LIST           4  - variable type for this entry

Data chain:     0  - ptr to data record for next template (HEAD)
 HEAD           4  - ptr to data record for this template (PRDT)

Data entry:     0  - ptr to next data record (PRDT)
 PRDT           4  - number of entries
                8  - ptr to data for first template entry
                     (INTG/STRG/STR0/GSTR/BOOL/LSTD/POTR/CHAR)
                n  - ptr to data for nth template entry
              n+4  - count of usage for this block

                If data type is boolean or list, ptr is like a data entry, viz:

Boolean entry:  0  - ptr to false value (INTG/STRG/STR0/GSTR/POTR/CHAR)
 BOOL           4  - ptr to true value

List entry:     0  - ptr to next entry in this list (LSTD)
 LSTD           4  - number of entries
                8  - ptr to first list entry
                     (INTG/STRG/STR0/GSTR/POTR/CHAR)
                n  - ptr to nth list entry

Character translation list:
 (CHAR)         0  - ptr to next character
                4  - character to be translated
                5  - number of bytes in translation string
                6+ - translation string

Printer support list:
 PSUP           0  - ptr to next printer
                4  - ptr to printer support name, eg "ps" (STRG)
                8  - ptr to template structure (TMPT)
               12  - ptr to data structure (HEAD)
               16  - ptr to list of installed printers (PRNT)
               20  - messages descriptor
               24  - ptr to list of windows
               28  - flags: 0 - BASIC support (as opposed to module)
                            1 - data has been modified
                            2 - back end supplies Connections window
                            3 - requires Null_Reason_Code events
                            4 - direct drive printing available
                        5 ~ 7 - not used (must be 0)
                       8 ~ 15 - timeout required for Wimp_PollIdle (if bit 3 set)
               32  - filetype for raw data
               36  - text printing capability flag:
                            0 - plain text is treated just like fancy text
                            1 - split flag must be set if buffer size is exceeded
                            2 - page pausing is required
                            3 - back-end supports multi-column pages
               40  - size of a CNFG block (in words)
               44  - support code version number
               48  - version of !Printers required
               52  - size of a CNCT block (in words) if supplied by back end

Installed printer list:
 PRNT           0  - ptr to next installed printer in this class
                4  - ptr to PSUP block for this printer
                8  - ptr to printer type (STRG)
               12  - ptr to connection details (CNCT)
               16  - ptr to configuration details (CNFG)
               20  - iconbar icon handle
               24  - flags: 0 - active/inactive
                            1 - currently selected printer
                            2 - paused
                            3 - printing
                            4 - highlighted
                            5 - suspended
                            6 - printer does NOT support text printing
                            7 - printer supports fast parallel port
                   8, ..., 15 - icon priority
               28  - printpane1 icon handle
               32  - queue details (QUEU)
               36  - page size details (PSZE) (NB now a pointer into the REAL data)
               40  - ptr to printer name (if 0, connection information is shown)
               44  - ptr to sprite name (if 0, printer support name is used)
               48  - pause window handle
               52  - ptr to font list. Note that this is NOT saved to file.
               56  - time until next null event required (-1 <=> none)

Font list:
 FONT           0  - ptr to next font
                4  - ptr to Acorn font name
                8  - ptr to foreign font name
               12  - font word
                     Use of this depends on the back-end but PS layout is:
                      bit 31 - new font to be downloaded
                          30 - font is not present in font file - delete
                           1 } tells PDriverPS what it is.
                           0 } 1 => font
                     All other bits reserved.

Connection details:
 CNCT           0  - connection type: 0 - none
                                      1 - parallel
                                      2 - serial
                                      4 - econet
                                      5 - file
                                      6 - NFS
                                      7 - direct drive
                4  - baud rate (as per OS_SerialOp 6)
                5  - XON/XOFF flag
                6  - flags:
                        bit 0 - connection is spooled via file
                        bit 1 - append to file
                7  - unused
                8  - data format (as per OS_SerialOp 1)
               12  - ptr to econet details
                     either the name or net/station of printer server
               16  - ptr to filename
               20  - ptr to NFS server
               24  - ptr to NFS printer
               28  - ptr to NFS username
               32  - ptr to NFS options

Configuration details:
 (CNFG)              printer dependant

 PS layout:
                0  - Flags: bit 0 - print title
                                1 - print line numbers
                                2 - page orientation is landscape
                                3 - paper feed is manual, if no feed name
                                4 - colour is on
                                5 - verbose prologue required
                                6 - PostScript-runtime accent creation required
                                8 - text scale
                               16 - number of columns (less 1)
                               24 - control code processing
                                              00 - Standard
                                              01 - Display
                                              10 - Ignore
                4  - number of file holding font information
                8  - ptr to feed name

 DP layout:
                0  - flags: 0 - Unused (was paper feed = Manual)
                            1 - print title
                            2 - print line numbers
                            3 - print linefeeds
                            4 - text quality: 00 - no highlights
                                              01 - draft
                                              10 - NLQ
                            8 - control code processing:
                                              00 - Standard
                                              01 - Display
                                              10 - Ignore
                           16 - paper feed:
                                            0000 - Auto
                                            0001 - Manual
                                            0010 - Roll
                4  - pointer to text choice
                8  - pointer to graphics choice
               12  - graphics quality: byte 1: 0 = mono
                                               1 = grey
                                               2 = colour
                                       byte 2: 1 = dithered
                                               4 = small
                                               8 = large

 LJ layout:
                0  - flags: 0 - paper feed is manual
                            1 - print title
                            2 - print line numbers
                            3 - page orientation is landscape
                            4 - text quality: 00 - no highlights
                                              01 - draft
                                              10 - NLQ
                            8 - control code processing
                                              00 - Standard
                                              01 - Display
                                              10 - Ignore
                4  - pointer to text choice
                8  - pointer to graphics choice
               12  - graphics quality: byte 1: 0 = mono
                                               1 = grey
                                               2 = colour
                                       byte 2: 1 = dithered
                                               4 = small
                                               8 = large

Window list:
 (WIND)         0  - ptr to next window
                4  - window handle
                8  - PSUP value associated with this window
               12  - PRNT value associated with this window
               16  - window name

Queue details:
 (QUEU)         0  - ptr to next queue entry
                4  - 5 byte time of queue entry
               11  - queue status: 0 (1) - paused
                                   1 (2) - temporary file
                                   2 (4) - suspended
                                   3 (8) - highlighted
               12  - file handle for input
               16  - ptr to name of "sender" of this file, eg Edit, adfs::Fil's
               20  - ptr to full pathname of file
               24  - ptr to leafname
               28  - file extent
               32  - percentage printed
               36  - file type
               40  - file handle for output
               44  - ptr to public text printing block (TPUB)
               48  - ptr to private text printing block (TPRV)
               52  - ptr to output buffer (256 bytes) (TBFF)
               56  - output buffer pointer (data going into buffer)
               60  - output buffer pointer (data coming out of buffer)
               64  - ptr to character translation list (CHAR)
               68  - scratch file name
               72  - file handle for output to scratch file

Page size details:
 (PSZE)         0  - ptr to next page size
                4  - ptr to page size name
                8  - page width
               12  - page height
               16  - bottom margin
               20  - top margin
               24  - left margin
               28  - right margin
               32  - text bottom
               36  - text top
               40  - text left
               44  - text right
               48  - text height
               52  - flag: 0 if not a user defined paper size, otherwise 1
