-- CGBandFormat.mesa    Cedar 3.2 version
-- Last edit by Ken Pier,  July 16, 1982 3:01 pm

--NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
--these definitions must ABSOLUTELY MIRROR the corresponding ones in the
--engine software, MesaBandFormat.mesa.
--MAKE NO CHANGES TO THE ONE WITHOUT CHANGING THE OTHER !!!!

DIRECTORY
  CGBandDevice USING [BandDevice];

CGBandFormat: DEFINITIONS = {

-- 8.5 * 11 * 384 * 384 = 13,787,136  (bits on Hornet page)
-- 5 * 5 * 5000 * 5000 = 625,000,000  (bits on reticle)

Marker: TYPE = INTEGER ← 23456; --supposed unique bit string
Bit: TYPE = BOOLEAN;

Type: TYPE = {all0, all1, brick, bits, fontcache, herald, end};--in three bit field
Flags: TYPE = MACHINE DEPENDENT RECORD [type: Type, rect: BOOLEAN];--four bit field
BandX: TYPE = [0..7777B]; -- twelve bit field adjoins Flags

--N.B.: ALL object types must start with the marker, then flags, then band

ObjectRef: TYPE = LONG POINTER TO Object;
Object: TYPE = MACHINE DEPENDENT RECORD [
  mark: Marker,
  flags: Flags, band: BandX,
  yStart: CARDINAL ← 0,
  height: CARDINAL ← 0,
  -- if rect=TRUE, only runs[0] is given
  -- if rect=FALSE, runs[0..height) are given
  runs: SEQUENCE COMPUTED CARDINAL OF Run
  -- if type=bits, bits follow
  -- if type=brick, brick follows
  ];
objectSize: CARDINAL = SIZE[Object]; -- VERIFY THIS IS SANS runs

RunRef: TYPE = LONG POINTER TO Run;
Run: TYPE = MACHINE DEPENDENT RECORD [
  xmin: CARDINAL, -- left end of scanline
  xmax: CARDINAL -- right end of scanline
  ];
runSize: CARDINAL = SIZE[Run];

HeraldRef: TYPE = LONG POINTER TO HeraldObject;
HeraldObject: TYPE = MACHINE DEPENDENT RECORD [
  mark: Marker,
  flags: Flags ← [type: herald, rect: FALSE], band: BandX ← 7777B,
  unused: [0..1777b], device: CGBandDevice.BandDevice,
  bandCount: CARDINAL,  --number of bands for this device
  bandHeight: CARDINAL, --height of each band in scanlines
  bandWidth: CARDINAL    --width of each band in words
  ];
heraldObjectSize: CARDINAL = SIZE[HeraldObject];

EndRef: TYPE = LONG POINTER TO EndObject;
EndObject: TYPE = MACHINE DEPENDENT RECORD [
  mark: Marker,
  flags: Flags ← [type: end, rect: FALSE], band: BandX ← 7777B,
  yStart: CARDINAL ← 177777B,
  height: CARDINAL ← 177777B
  ];
endObjectSize: CARDINAL = SIZE[EndObject];

--thresholded brick stuff

TBrickRef: TYPE = LONG POINTER TO TBrickRep;
TBrickRep: TYPE = RECORD [
  L,p: CARDINAL,       --length, height of brick
  D: INTEGER,          --displacement
  hx, hy: CARDINAL ← 0, --now unused, retained for compatibility
  color: CARDINAL,     --that this brick represents
  brickSize: CARDINAL,  --actual size of brick sequence
  brick: PACKED SEQUENCE max: NAT OF Bit
  ];
tBrickSize: CARDINAL = SIZE[TBrickRep];

LineRef: TYPE = LONG POINTER TO Line;
Line: TYPE = RECORD[PACKED SEQUENCE COMPUTED CARDINAL OF Bit];

}.--CGBandFormat

--created by Pier, 2/15/82
--change Marker, band field; remove skipCount, run.Count, tail of EndObj, 3/14/82
--converted Refs from REF to LONG POINTER, 3/30/82
--removed hx, hy from TBrick July 13, 1982