-- TextBlt.mesa  (last edited by: Jim Frandeen, October 7, 1980  2:27 PM)

DIRECTORY
  MiscAlpha: FROM "MiscAlpha" USING [aTEXTBLT],
  Mopcodes: FROM "Mopcodes" USING [zMISC];

TextBlt: DEFINITIONS =
  BEGIN

  Function: TYPE = {display, format, resolve};

  TextBltArg: TYPE = MACHINE DEPENDENT RECORD [
    reserved: [0..37777B] ← 0,
    function: Function, -- display, format or resolve
    last: CARDINAL, -- index of last character to process
    text: LONG POINTER TO PACKED ARRAY CARDINAL OF CHARACTER,
    font: FontHandle, -- Long Pointer to font information
    dst: LONG POINTER, -- destination bitmap (display only)
    dstBpl: CARDINAL, -- Bits per line (display only)
    margin: CARDINAL, -- mica value of right margin (format only)
    space: INTEGER, -- width adjustment to pad characters (display, resolve)
    coord: POINTER TO ARRAY CARDINAL [0..0) OF CARDINAL  -- widths array for resolve
    ];

  TextBltArgAlignment: CARDINAL = 16;

  TextBltArgSpace: TYPE = ARRAY [1..SIZE[TextBltArg] + TextBltArgAlignment) OF
    UNSPECIFIED;

  AlignedTextBltArg: PROCEDURE [ip: POINTER TO TextBltArgSpace]
    RETURNS [p: POINTER TO TextBltArg] = INLINE
    BEGIN
    align: TYPE = MACHINE DEPENDENT RECORD [
      s: [0..LAST[WORD]/TextBltArgAlignment), z: [0..TextBltArgAlignment)];
    p ← LOOPHOLE[ip + TextBltArgAlignment - 1];
    LOOPHOLE[p, align].z ← 0;
    END;

  FontHandle: TYPE = LONG POINTER TO Font;

  Font: TYPE;

  Result: TYPE = {normal, margin, stop};

  TextBlt: PROCEDURE [
    index: CARDINAL, bitPos: CARDINAL, micaPos: CARDINAL, count: INTEGER,
    ptr: POINTER TO TextBltArg]
    RETURNS [
      newIndex: CARDINAL, newBitPos: CARDINAL, newMicaPos: CARDINAL,
      newCount: INTEGER, result: Result] = MACHINE CODE
    BEGIN Mopcodes.zMISC, MiscAlpha.aTEXTBLT; END;

  END.	-- of TextBlt

LOG
3-24-80 -- Guyton -- Created
July 30, 1980  10:56 AM -- Jim Frandeen -- Add FontRecord.height
August 29, 1980  3:29 PM -- Jim Frandeen -- Remove Font, rearrange parameters.
October 7, 1980  9:12 AM -- Jim Frandeen -- Add AlignedTextBltArg. Fix TextBlt Inline definition.