{$symtab-,$pagesize:62,$linesize:131,
$title:'SCANLINE.PAS -- Output Line to Line Printer'}
{	COPYRIGHT @ 1982
	Jim Holtman and Eric Holtman
	35 Dogwood Trail
	Randolph, NJ 07869
	(201) 361-3395
}
module scanline;
{$include:'simterm.inc'}
{$include:'graph.inc'}
procedure scan_line(const line : screen_buf);
type
    lines = 0..11; {for SUBline counters}
const
    BOLD = chr(27)*'E'*chr(27)*'G';
    REGULAR = chr(27)*'F'*chr(27)*'H';
    SPACETHIRD = chr(27)*'A'*chr(4)*chr(27)*'2';
    NORMAL = 7;
    UNDERLINE = 1;
    INTENSE = #0a;
    INTENSEUN = #09;
    REVERSE = #70;
    SPACENORMAL = chr(27)*'A'*chr(12)*chr(27)*'2';
    CR = chr(13);
    CRLF = chr(13)*chr(10);
var
    line_ctr [static] : lines;
    line0,line1,line2 : boolean;
    i,j,k,l,m : integer;
    count : integer;
    curstr : string(80);
value
    line_ctr := 0; {start with superscript line}

function space(now : lines; where : lines) : lines;
var
    dif : integer;
    space_code [static] : string(7);
value
    space_code := SPACENORMAL*CRLF; {DUMMY for spacing code}
begin
    dif := now-where;
    if dif >= 0 then dif := 12 - dif
    else dif := -dif;
    space_code[3] := chr(dif); {setup the right amount}
    xlpt1(space_code);
    space := where {new value}
end;

begin
    line0 := false;
    line1 := false;
    line2 := false;
    count := 1;
    for i := 1 to 80 do
    begin
	curstr[i] := ' ';
	case line[i].d_attr of

	INTENSE:
	    begin
		line0 := true;
		curstr[i] := chr(line[i].d_char)
	    end;

	NORMAL, UNDERLINE, REVERSE:
	    line1 := true;

	INTENSEUN:
	    line2 := true;

	otherwise
	    ; {just make sure}

	end;
    end;
    if line0 then begin
	line_ctr := space(line_ctr,4);
	xlpt1(curstr)
    end;
    if line1 then begin
	line_ctr := space(line_ctr,6);
	for i := 1 to 80 do begin
	    curstr[i] := ' ';
	    if line[i].d_attr = REVERSE then
		curstr[i] := chr(line[i].d_char);
	end;
	xlpt1(BOLD);
	xlpt1(curstr);
	xlpt1(CR);
	xlpt1(REGULAR);
	for i := 1 to 80 do
	begin
	    curstr[i] := ' ';
	    if line[i].d_attr = UNDERLINE then
		curstr[i] := '_';
	end;
	xlpt1(curstr);
	xlpt1(CR);
	for i := 1 to 80 do
	begin
	    curstr[i] := ' ';
	    if (line[i].d_attr = NORMAL) or (line[i].d_attr = UNDERLINE)
		then
		curstr[i] := chr(line[i].d_char);
	end;
	xlpt1(curstr);
    end;
    if line2 then begin
	line_ctr := space(line_ctr,8);
	for i := 1 to 80 do
	begin
	    curstr[i] := ' ';
	    if (line[i].d_attr = INTENSEUN) then
		curstr[i] := chr(line[i].d_char);
	end;
	xlpt1(curstr);
    end;
    xlpt1(CR*SPACENORMAL);
end;
end.
          for high b