-- Press.mesa,  Edit: Johnsson May 23, 1980  2:47 PM
-- converted to Laurel by Ken Pier, July 29, 1981  9:57 PM 

DIRECTORY
  PressFormat USING [Mica, micasPerInch],
  csD: FROM "CoreStreamDefs" USING [StreamHandle];

Press: DEFINITIONS =
  BEGIN
  
  
  Reset: PROCEDURE; -- gives back lots of storage
  
  Initialize: PROCEDURE;
  
  PutFontInTable: PROCEDURE [index: FontIndex, family: STRING, size: Points];
  FlushFontBuffers: PROCEDURE;
  
  -- call once for each document (i.e. each press file)
  
  Start: PROCEDURE [docName: STRING, file: csD.StreamHandle];
  Abort: PROCEDURE;
  Finish: PROCEDURE;
  
  -- These will work ok all by themselves.
  -- They know about CR, FF, and TAB, and will STUPIDLY process line/page overflows.
  
  String: PROCEDURE [STRING];
  Character: PROCEDURE [CHARACTER];
  SetCurrentFont: PROCEDURE [FontIndex, FontWeight, FontSlope];
  SkipSomeSpace: PROCEDURE [Mica]; -- for indenting
  -- for fancy looking results
  
  PieceOfLine: PROCEDURE [s: STRING, width: Mica];
  SetDocumentUserName: PROCEDURE [STRING];
  SetDocumentCreationDate: PROCEDURE [STRING];
  SetHeaderText: PROCEDURE [STRING, BOOLEAN];
  SetTrailerText: PROCEDURE [STRING, BOOLEAN];
  SetNumberOfCopies: PROCEDURE [CARDINAL];
  
  SetMode: PROCEDURE [columns: CARDINAL, between: Mica, mode: Mode];
  SetMargins: PROCEDURE [l, r, t, b: Mica];
  SetCurrentTabWidth: PROCEDURE [Mica];
  SetCurrentLineLeading: PROCEDURE [Mica];
  SetCurrentPosition: PROCEDURE [x, y: Mica];
  
  GetCurrentPageNumber: PROCEDURE RETURNS [CARDINAL];
  SetCurrentPageNumber: PROCEDURE [CARDINAL];
  
  GetCurrentPosition: PROCEDURE RETURNS [x, y: Mica];
  
  GetWidthOfString: PROCEDURE [STRING] RETURNS [Mica]; -- in current font
  
  GetWidthOfCharacter: PROCEDURE [CHARACTER] RETURNS [Mica];
  GetHeightOfFont: PROCEDURE [FontIndex] RETURNS [Mica];
  
  SetWidthOfSpace: PROCEDURE [w: Mica];
  ResetWidthOfSpace: PROCEDURE;
  DrawRectangle: PROCEDURE [w, h: Mica];
  
  pointsPerInch: CARDINAL = 72;
  micasPerInch: CARDINAL = PressFormat.micasPerInch;
  
  Mica: TYPE = PressFormat.Mica;
  magicNonPrintingWidth: Mica = -32767 - 1; --100000B;
  
  Points: TYPE = CARDINAL;
  
  numberOfFonts: CARDINAL = 16;
  FontIndex: TYPE = [0..numberOfFonts);
  FontWeight: TYPE = {medium, bold --, light--};
  FontSlope: TYPE = {regular, italic};
  Mode: TYPE = {portrait, landscape};
  
  pageHeight: Mica = 11*micasPerInch;
  pageWidth: Mica = 8*micasPerInch + micasPerInch/2;
  
  defaultLineLeading: Mica = micasPerInch/pointsPerInch; -- one point
  
  defaultTabSpacing: Mica = 8*defaultCharWidth;
  
  defaultCharWidth: Mica = 173; -- for Gacha8
  
  defaultLineHeight: Mica = 276;
  
  defaultHeight: Mica = pageHeight - defaultLeft - defaultRight;
  defaultWidth: Mica = pageWidth - defaultTop - defaultBottom;
  
  defaultLeft: Mica = micasPerInch;
  defaultRight: Mica = micasPerInch;
  defaultTop: Mica = micasPerInch;
  defaultBottom: Mica = micasPerInch;
  
  END.

--LOG  July 29, 1981  9:56 PM

--Former errors

  BadParameters: ERROR; -- probably bad args
  
  InternalError: ERROR; -- probably buggy code
  
  MoreThan16Fonts: ERROR;
  ELBufferOverflow: ERROR;
  PartBufferOverflow: ERROR;