-- TexJustifyDefs.mesa

-- last written by Doug Wyatt, November 10, 1979  2:29 AM

DIRECTORY
	TexDefs: FROM "TexDefs",
	TexNodeDefs: FROM "TexNodeDefs",
	TexTableDefs: FROM "TexTableDefs";

TexJustifyDefs: DEFINITIONS =
BEGIN OPEN TexNodeDefs, TexDefs;

-- Justification takes three parameters.
-- 	list: the hlist to be broken into lines and justified
-- 	LineWidth: a procedure which Justification calls to determine
-- 		the desired width and indentation for a given line number
-- 	NewLine: a procedure which Justification calls once for each
-- 		new line it produces

-- For a given line number, return the desired width.
-- The first line is line 0.
LineWidthProc: TYPE = PROCEDURE[line: CARDINAL] RETURNS[width: Dimn];

-- Justification calls NewLine to emit a line. It is the callers
-- responsibility to do something with the inserts (either append
-- them to a list or delete them). The info parameter may be used
-- to determine any penalty for breaking after the line.
NewLineProc: TYPE = PROCEDURE
	[linebox: BoxNodePtr, inserts: NodeListPtr, info: LineInfo];
LineInfo: TYPE = RECORD[first,widow,broken: BOOLEAN];

Justification: PROCEDURE[list: NodeListPtr,
	LineWidth: LineWidthProc, NewLine: NewLineProc]
	RETURNS[lastwidth: Dimn];

Hyphenate: PROCEDURE [p: NodePtr, n: CARDINAL, dhyphen: FChar];

TexJust: PRIVATE PROGRAM;
TexHyph: PRIVATE PROGRAM;

TexJustifyControl: PROGRAM;

END.