home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
TURBOM2
/
BOXDEMO.LBR
/
BOXLIB.MOD
< prev
next >
Wrap
Text File
|
2000-06-30
|
3KB
|
142 lines
implementation module boxlib;
type
graphics = (UR, LR, UL, LL, UH, LH, RV, LV);
gchars = array [UR..LV] of char;
var
wideset : gchars;
narrowset : gchars;
currentset : gchars;
(* Internal Support Routines *)
procedure DrawUpperHorizontal;
begin
writechar (currentset[UH]);
end DrawUpperHorizontal;
procedure DrawLowerHorizontal;
begin
writechar (currentset[LH]);
end DrawLowerHorizontal;
procedure DrawLeftVertical;
begin
writechar (currentset[LV]);
end DrawLeftVertical;
procedure DrawRightVertical;
begin
writechar (currentset[RV]);
end DrawRightVertical;
procedure DrawUR;
begin
writechar (currentset[UR]);
end DrawUR;
procedure DrawLR;
begin
writechar (currentset[LR]);
end DrawLR;
procedure DrawUL;
begin
writechar (currentset[UL]);
end DrawUL;
procedure DrawLL;
begin
writechar (currentset[LL]);
end DrawLL;
procedure GraphicsOn;
begin
writechar (33C);
writechar ('$');
end GraphicsOn;
procedure GraphicsOff;
begin
writechar (33C);
writechar ('%');
end GraphicsOff;
(* Externally-Accessed Routines *)
procedure InitBox;
var
i : graphics;
wide, narr : char;
begin
for i := UR to LV do
case i of
| UR : wide := ']';
narr := 'G';
| LR : wide := '^';
narr := 'H';
| UL : wide := '\';
narr := 'F';
| LL : wide := '[';
narr := 'E';
| UH : wide := 'Z';
narr := 'K';
| LH : wide := 'X';
narr := 'K';
| RV : wide := 'W';
narr := 'J';
| LV : wide := 'Y';
narr := 'J';
end;
wideset[i] := wide;
narrowset[i] := narr;
currentset[i] := narr;
end;
end InitBox;
procedure SetBox (selection : boxtype);
var
i : graphics;
begin
for i := UR to LV do
if selection = WIDE then
currentset[i] := wideset[i];
else
currentset[i] := narrowset[i];
end;
end;
end SetBox;
procedure Clear;
begin
clearscreen;
end Clear;
procedure At (row, column : integer);
begin
gotoxy (column, row);
end At;
procedure DrawBox (length, width : integer; origin : coordinate);
var
i : integer;
begin
GraphicsOn;
gotoxy (origin.column, origin.row);
DrawUL;
for i := 2 to width-1 do DrawUpperHorizontal; end;
DrawUR;
for i := 2 to length-1 do
gotoxy (origin.column, origin.row + i - 1);
DrawLeftVertical;
gotoxy (origin.column + width - 1, origin.row + i - 1);
DrawRightVertical;
end;
gotoxy (origin.column, origin.row + length - 1);
DrawLL;
for i := 2 to width-1 do DrawLowerHorizontal; end;
DrawLR;
GraphicsOff;
end DrawBox;
end boxlib.