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
/
PROGRAMS
/
LIST
/
TPBANNER.LBR
/
BANNER.PZS
/
BANNER.PAS
Wrap
Pascal/Delphi Source File
|
2000-06-30
|
13KB
|
364 lines
Program Banner;
{[A+,T=3] Instructions to PasMat.}
{$C- <--- These are to }
{$V- <--- optimize }
{$W0 <--- the Turbo }
{$X+ <--- Compiler. }
{
Written by Scott R. Houck 11 Jan 86
Modified by Cyrus Patel 13 Feb 86 for CP/M-80
This program produces banners which can be sent to the screen
or to a file. If sent to a file, the output may be appended to
to an existing file if desired.
The syntax is as follows:
BANNER [/B=banner] [/I=infile] [/O=outfile] [/C=char]
where
banner = a character string of maximum length 10
infile = an input file containing the banner(s)
outfile = an output file to which the banner(s) will be written
char = character to be used in printing the banner
(default = the character being printed)
NOTES:
1. Options may be specified in any order, but there must be
at least one space between each one. Do not put spaces
on either side of the equals sign.
2. You may use LST: for the filename if you want to send the
output to the printer.
3. To indicate a space in the banner when using the /B option, use
the carat symbol (^). Example: BANNER /O=DISKFILE /B=JOHN^DOE
However, this is not necessary if you are using the /I option.
4. Valid characters are 0-9, A-Z, and !"#$%&'()*+,-./:;<=>?@[\]
Any other characters will be printed as a space.
6. All lower case letters are converted to upper case.
7. Three blank lines are written before the banner is output.
8. Note that /B and /I are mutually exclusive and will produce a
syntax error if used together.
9. If all options are omitted or if the command line does not contain
either /B or /I, the command syntax is printed.
}
Type
Str13 = String [13];
Str80 = String [80];
Char_Pattern = Array [1..10] of Integer;
Const
Bit_Value: Array
[1..10] of Integer = (1, 2, 4, 8, 16, 32, 64, 128, 256, 512);
Char_Def: Array [#32..#94] of Char_Pattern = (
{32:' '} ($000, $000, $000, $000, $000, $000, $000, $000, $000, $000),
{33:'!'} ($030, $078, $0FC, $0FC, $078, $078, $030, $000, $030, $030),
{34:'"'} ($1CE, $1CE, $1CE, $1CE, $000, $000, $000, $000, $000, $000),
{35:'#'} ($0CC, $0CC, $0CC, $3FF, $0CC, $0CC, $3FF, $0CC, $0CC, $0CC),
{36:'$'} ($030, $1FE, $3FF, $330, $3FF, $1FF, $033, $3FF, $1FE, $030),
{37:'%'} ($1C3, $366, $36C, $1D8, $030, $060, $0CE, $19B, $31B, $20E),
{38:'&'} ($1E0, $330, $330, $1C0, $1E0, $331, $31A, $31C, $1FA, $0E1),
{39:'''} ($070, $0F8, $078, $010, $020, $000, $000, $000, $000, $000),
{40:'('} ($004, $018, $030, $060, $060, $060, $060, $030, $018, $004),
{41:')'} ($080, $060, $030, $018, $018, $018, $018, $030, $060, $080),
{42:'*'} ($000, $000, $000, $084, $048, $2FD, $048, $084, $000, $000),
{43:'+'} ($000, $000, $078, $078, $3FF, $3FF, $078, $078, $000, $000),
{44:','} ($000, $000, $000, $000, $000, $070, $0F8, $078, $010, $020),
{45:'-'} ($000, $000, $000, $000, $3FF, $3FF, $000, $000, $000, $000),
{46:'.'} ($000, $000, $000, $000, $000, $000, $000, $078, $0FC, $078),
{47:'/'} ($001, $003, $006, $00C, $018, $030, $060, $0C0, $180, $100),
{48:'0'} ($078, $0FC, $186, $303, $303, $303, $303, $186, $0FC, $078),
{49:'1'} ($030, $0F0, $0B0, $030, $030, $030, $030, $030, $3FF, $3FF),
{50:'2'} ($1FE, $3FF, $203, $003, $003, $018, $060, $0C0, $3FF, $3FF),
{51:'3'} ($3FF, $3FE, $00C, $018, $038, $00E, $006, $203, $3FF, $1FE),
{52:'4'} ($01C, $03C, $06C, $0CC, $18C, $3FF, $3FF, $00C, $00C, $00C),
{53:'5'} ($3FF, $3FF, $300, $300, $3FE, $3FF, $003, $203, $3FF, $1FE),
{54:'6'} ($1FE, $3FF, $301, $300, $3FE, $3FF, $303, $303, $3FF, $1FE),
{55:'7'} ($3FF, $3FF, $006, $00C, $018, $030, $060, $0C0, $300, $300),
{56:'8'} ($1FE, $3FF, $303, $303, $1FE, $1FE, $303, $303, $3FF, $1FE),
{57:'9'} ($1FE, $3FF, $303, $303, $3FF, $1FF, $003, $003, $3FF, $1FE),
{58:':'} ($000, $000, $000, $078, $0FC, $078, $000, $078, $0FC, $078),
{59:';'} ($000, $038, $07C, $038, $000, $038, $07C, $03C, $004, $008),
{60:'<'} ($000, $000, $003, $00C, $030, $0C0, $030, $00C, $003, $000),
{61:'='} ($000, $000, $000, $3FF, $3FF, $000, $3FF, $3FF, $000, $000),
{62:'>'} ($000, $000, $0C0, $030, $00C, $003, $00C, $030, $0C0, $000),
{63:'?'} ($1FE, $3FF, $303, $006, $00C, $018, $018, $000, $018, $018),
{64:'@'} ($1FE, $303, $33B, $36B, $363, $363, $366, $37C, $300, $1FE),
{65:'A'} ($1FE, $3FF, $303, $303, $303, $3FF, $3FF, $303, $303, $303),
{66:'B'} ($3FE, $3FF, $303, $303, $3FE, $3FE, $303, $303, $3FF, $3FE),
{67:'C'} ($1FE, $3FF, $301, $300, $300, $300, $300, $301, $3FF, $1FE),
{68:'D'} ($3FE, $3FF, $303, $303, $303, $303, $303, $303, $3FF, $3FE),
{69:'E'} ($3FF, $3FF, $300, $300, $3E0, $3E0, $300, $300, $3FF, $3FF),
{70:'F'} ($3FF, $3FF, $300, $300, $3E0, $3E0, $300, $300, $300, $300),
{71:'G'} ($1FE, $3FF, $300, $300, $31F, $31F, $303, $303, $3FF, $1FF),
{72:'H'} ($303, $303, $303, $303, $3FF, $3FF, $303, $303, $303, $303),
{73:'I'} ($3FF, $3FF, $030, $030, $030, $030, $030, $030, $3FF, $3FF),
{74:'J'} ($0FF, $0FF, $018, $018, $018, $018, $318, $318, $3F8, $1F0),
{75:'K'} ($303, $306, $318, $360, $3E0, $330, $318, $30C, $306, $303),
{76:'L'} ($300, $300, $300, $300, $300, $300, $300, $300, $3FF, $3FF),
{77:'M'} ($303, $3CF, $37B, $333, $333, $303, $303, $303, $303, $303),
{78:'N'} ($303, $383, $343, $363, $333, $333, $31B, $30B, $307, $303),
{79:'O'} ($1FE, $3FF, $303, $303, $303, $303, $303, $303, $3FF, $1FE),
{80:'P'} ($3FE, $3FF, $303, $303, $3FF, $3FE, $300, $300, $300, $300),
{81:'Q'} ($1FE, $3FF, $303, $303, $303, $303, $33B, $30F, $3FE, $1FB),
{82:'R'} ($3FE, $3FF, $303, $303, $3FF, $3FE, $318, $30C, $306, $303),
{83:'S'} ($1FE, $3FF, $301, $300, $3FE, $1FF, $003, $203, $3FF, $1FE),
{84:'T'} ($3FF, $3FF, $030, $030, $030, $030, $030, $030, $030, $030),
{85:'U'} ($303, $303, $303, $303, $303, $303, $303, $303, $3FF, $1FE),
{86:'V'} ($303, $303, $186, $186, $186, $186, $0CC, $0CC, $078, $030),
{87:'W'} ($303, $303, $303, $303, $333, $333, $333, $37B, $1CE, $186),
{88:'X'} ($303, $186, $0CC, $078, $030, $078, $0CC, $186, $303, $303),
{89:'Y'} ($303, $186, $0CC, $078, $030, $030, $030, $030, $030, $030),
{90:'Z'} ($3FF, $3FE, $00C, $018, $030, $030, $060, $0C0, $1FF, $3FF),
{91:'['} ($0FE, $0FE, $0C0, $0C0, $0C0, $0C0, $0C0, $0C0, $0FE, $0FE),
{92:'\'} ($200, $300, $180, $0C0, $060, $030, $018, $00C, $006, $002),
{93:']'} ($0FE, $0FE, $006, $006, $006, $006, $006, $006, $0FE, $0FE),
{94:'^'} ($000, $000, $000, $000, $000, $000, $000, $000, $000, $000));
Var
Banner: Str13;
Character: Char;
Infile, Outfile: Text;
Param: Array [1..4] of Str80;
InfileName, OutfileName: Str80;
Slash_B, Slash_C, Slash_I, Slash_O: Boolean;
{----------------------------------------------------------------------}
Procedure UpperCase(Var AnyStr: Str80);
Var
Index: Integer;
Begin
For Index := 1 to Length(AnyStr) do
AnyStr[Index] := UpCase(AnyStr[Index])
End;
{----------------------------------------------------------------------}
Function Exist(FileName: Str80): Boolean;
Var
TempFile: File;
Begin
Assign(TempFile, FileName);
{$I-}
Reset(TempFile);
{$I+}
Exist := IoResult = 0;
Close(TempFile)
End;
{----------------------------------------------------------------------}
Procedure Print_Syntax;
Begin
WriteLn('The syntax is as follows:'^J);
WriteLn(' BANNER [/B=banner] [/I=infile] [/O=outfile] ',
'[/C=char]'^J);
WriteLn('where'^J);
WriteLn(' banner = character string of maximum length 10');
WriteLn(' infile = input file containing banner text');
WriteLn(' outfile = output file to which the banner(s) will be ',
'written');
WriteLn(' char = character to be used in printing the banner');
WriteLn(' (default = the character being printed)'^J);
WriteLn('Note that /B and /I are mutually exclusive.');
WriteLn('Use a carat (^) for a space if using /B.');
WriteLn('Valid characters are 0-9, A-Z, and ',
'!"#$%&''()*+,-./:;<=>?@[\]')
End;
{----------------------------------------------------------------------}
Procedure Parse;
Var
Ch1, Ch2, Ch3: Char;
N, B, C, I, O: Integer;
Procedure Error;
Begin
Write(Chr(7));
Print_Syntax;
Halt
End;
Begin { Parse }
Slash_B := false;
B := 0;
Slash_C := false;
C := 0;
Slash_I := false;
I := 0;
Slash_O := false;
O := 0;
If ParamCount = 0 then
Begin
Print_Syntax;
Halt
End;
If ParamCount > 4 then
Error;
For N := 1 to ParamCount do
Begin
Param[N] := ParamStr(N);
UpperCase(Param[N]);
Ch1 := Param[N][1];
Ch2 := Param[N][2];
Ch3 := Param[N][3];
If (Ch1 <> '/') or Not (Ch2 in ['B', 'C', 'I', 'O']) then
Error;
If Ch2 = 'B' then
Begin
Slash_B := true;
B := N
End;
If Ch2 = 'C' then
Begin
Slash_C := true;
C := N
End;
If Ch2 = 'I' then
Begin
Slash_I := true;
I := N
End;
If Ch2 = 'O' then
Begin
Slash_O := true;
O := N
End;
If (Ch2 in ['B', 'C', 'I', 'O']) and (Ch3 <> '=') then
Error;
If (Ch2 = 'A') and (Length(Ch2) > 2) then
Error
End;
If Slash_B and Slash_I then
Error;
If Not Slash_B and Not Slash_I then
Error;
If Slash_B then
Begin
Banner := Param[B];
Delete(Banner, 1, 3)
End;
If Slash_C then
Character := Param[C][4];
If Slash_I then
Begin
InfileName := Param[I];
Delete(InfileName, 1, 3)
End;
If Slash_O then
Begin
OutfileName := Param[O];
Delete(OutfileName, 1, 3)
End
End;
{----------------------------------------------------------------------}
Procedure Heading(Message: Str13);
Var
I, J, K: Integer;
Begin
If Slash_O then
WriteLn(Outfile, ^M^J^M^J^M^J)
else
WriteLn(^J^J^J);
For I := 1 to 10 do
Begin
For J := 1 to Length(Message) do
Begin
If Not (Message[J] in [#32..#94]) then
Message[J] := #32;
For K := 10 downto 1 do
If Char_Def[Message[J], I] and
Bit_Value[K] = Bit_Value[K] then
Begin
If Not Slash_C then
Character := Message[J];
If Slash_O then
Write(Outfile, Character)
else
Write(Character)
End
else
Begin
If Slash_O then
Write(Outfile, ' ')
else
Write(' ')
End;
If Slash_O then
Write(Outfile, ' ')
else
Write(' ')
End;
If Slash_O then
WriteLn(Outfile)
else
WriteLn
End
End;
{----------------------------------------------------------------------}
Begin { Banner }
Parse;
If Slash_O then
Begin
Assign(Outfile, OutfileName);
Rewrite(Outfile)
End;
If Slash_I then
Begin
Assign(Infile, InfileName);
Reset(Infile);
While Not Eof(Infile) do
Begin
ReadLn(Infile, Banner);
UpperCase(Banner);
Heading(Banner)
End;
Close(Infile)
End
else
Heading(Banner);
If Slash_O then
Close(Outfile)
End.