Contributor: SCOTT R. HOUCK 
Program BannerC;
{$V-}
{ Written by Scott R. Houck
 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 [/A]] [/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)
 /A = append to file if it already exists
 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 PRN for the filename if you want to send the
 output to the printer. If you choose to do this, do not
 use the /A option.
 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.
 10. /A will produce a syntax error if used without /O.
 11. You may not use < or> with the /B option because DOS would
 interpret it as redirection of standard input and output.
}
USES DOS,CRT;
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,ドル0ドルFC,0ドルFC,078,ドル078,ドル030,ドル000,ドル030,ドル030ドル),
 {34:'"'} (1ドルCE,1ドルCE,1ドルCE,1ドルCE,000,ドル000,ドル000,ドル000,ドル000,ドル000ドル), 
 {35:'#'} (0ドルCC,0ドルCC,0ドルCC,3ドルFF,0ドルCC,0ドルCC,3ドルFF,0ドルCC,0ドルCC,0ドルCC), 
 {36:'$'} (030,ドル1ドルFE,3ドルFF,330,ドル3ドルFF,1ドルFF,033,ドル3ドルFF,1ドルFE,030ドル),
 {37:'%'} (1ドルC3,366,ドル36ドルC,1ドルD8,030,ドル060,ドル0ドルCE,19ドルB,31ドルB,20ドルE),
 {38:'&'} (1ドルE0,330,ドル330,ドル1ドルC0,1ドルE0,331,ドル31ドルA,31ドルC,1ドルFA,0ドルE1), 
 {39:'''} (070,ドル0ドルF8,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,ドル2ドルFD,048,ドル084,ドル000,ドル000ドル),
 {43:'+'} (000,ドル000,ドル078,ドル078,ドル3ドルFF,3ドルFF,078,ドル078,ドル000,ドル000ドル),
 {44:','} (000,ドル000,ドル000,ドル000,ドル000,ドル070,ドル0ドルF8,078,ドル010,ドル020ドル),
 {45:'-'} (000,ドル000,ドル000,ドル000,ドル3ドルFF,3ドルFF,000,ドル000,ドル000,ドル000ドル), 
 {46:'.'} (000,ドル000,ドル000,ドル000,ドル000,ドル000,ドル000,ドル078,ドル0ドルFC,078ドル),
 {47:'/'} (001,ドル003,ドル006,ドル00ドルC,018,ドル030,ドル060,ドル0ドルC0,180,ドル100ドル),
 {48:'0'} (078,ドル0ドルFC,186,ドル303,ドル303,ドル303,ドル303,ドル186,ドル0ドルFC,078ドル),
 {49:'1'} (030,ドル0ドルF0,0ドルB0,030,ドル030,ドル030,ドル030,ドル030,ドル3ドルFF,3ドルFF),
 {50:'2'} (1ドルFE,3ドルFF,203,ドル003,ドル003,ドル018,ドル060,ドル0ドルC0,3ドルFF,3ドルFF),
 {51:'3'} (3ドルFF,3ドルFE,00ドルC,018,ドル038,ドル00ドルE,006,ドル203,ドル3ドルFF,1ドルFE),
 {52:'4'} (01ドルC,03ドルC,06ドルC,0ドルCC,18ドルC,3ドルFF,3ドルFF,00ドルC,00ドルC,00ドルC),
 {53:'5'} (3ドルFF,3ドルFF,300,ドル300,ドル3ドルFE,3ドルFF,003,ドル203,ドル3ドルFF,1ドルFE),
 {54:'6'} (1ドルFE,3ドルFF,301,ドル300,ドル3ドルFE,3ドルFF,303,ドル303,ドル3ドルFF,1ドルFE),
 {55:'7'} (3ドルFF,3ドルFF,006,ドル00ドルC,018,ドル030,ドル060,ドル0ドルC0,300,ドル300ドル),
 {56:'8'} (1ドルFE,3ドルFF,303,ドル303,ドル1ドルFE,1ドルFE,303,ドル303,ドル3ドルFF,1ドルFE),
 {57:'9'} (1ドルFE,3ドルFF,303,ドル303,ドル3ドルFF,1ドルFF,003,ドル003,ドル3ドルFF,1ドルFE),
 {58:':'} (000,ドル000,ドル000,ドル078,ドル0ドルFC,078,ドル000,ドル078,ドル0ドルFC,078ドル),
 {59:';'} (000,ドル038,ドル07ドルC,038,ドル000,ドル038,ドル07ドルC,03ドルC,004,ドル008ドル),
 {60:'<'} (000,ドル000,ドル003,ドル00ドルC,030,ドル0ドルC0,030,ドル00ドルC,003,ドル000ドル), {61:'='} (000,ドル000,ドル000,ドル3ドルFF,3ドルFF,000,ドル3ドルFF,3ドルFF,000,ドル000ドル), {62:'>'} (000,ドル000,ドル0ドルC0,030,ドル00ドルC,003,ドル00ドルC,030,ドル0ドルC0,000ドル),
 {63:'?'} (1ドルFE,3ドルFF,303,ドル006,ドル00ドルC,018,ドル018,ドル000,ドル018,ドル018ドル), 
 {64:'@'} (1ドルFE,303,ドル33ドルB,36ドルB,363,ドル363,ドル366,ドル37ドルC,300,ドル1ドルFE), 
 {65:'A'} (1ドルFE,3ドルFF,303,ドル303,ドル303,ドル3ドルFF,3ドルFF,303,ドル303,ドル303ドル),
 {66:'B'} (3ドルFE,3ドルFF,303,ドル303,ドル3ドルFE,3ドルFE,303,ドル303,ドル3ドルFF,3ドルFE),
 {67:'C'} (1ドルFE,3ドルFF,301,ドル300,ドル300,ドル300,ドル300,ドル301,ドル3ドルFF,1ドルFE),
 {68:'D'} (3ドルFE,3ドルFF,303,ドル303,ドル303,ドル303,ドル303,ドル303,ドル3ドルFF,3ドルFE),
 {69:'E'} (3ドルFF,3ドルFF,300,ドル300,ドル3ドルE0,3ドルE0,300,ドル300,ドル3ドルFF,3ドルFF),
 {70:'F'} (3ドルFF,3ドルFF,300,ドル300,ドル3ドルE0,3ドルE0,300,ドル300,ドル300,ドル300ドル),
 {71:'G'} (1ドルFE,3ドルFF,300,ドル300,ドル31ドルF,31ドルF,303,ドル303,ドル3ドルFF,1ドルFF),
 {72:'H'} (303,ドル303,ドル303,ドル303,ドル3ドルFF,3ドルFF,303,ドル303,ドル303,ドル303ドル),
 {73:'I'} (3ドルFF,3ドルFF,030,ドル030,ドル030,ドル030,ドル030,ドル030,ドル3ドルFF,3ドルFF),
 {74:'J'} (0ドルFF,0ドルFF,018,ドル018,ドル018,ドル018,ドル318,ドル318,ドル3ドルF8,1ドルF0),
 {75:'K'} (303,ドル306,ドル318,ドル360,ドル3ドルE0,330,ドル318,ドル30ドルC,306,ドル303ドル),
 {76:'L'} (300,ドル300,ドル300,ドル300,ドル300,ドル300,ドル300,ドル300,ドル3ドルFF,3ドルFF),
 {77:'M'} (303,ドル3ドルCF,37ドルB,333,ドル333,ドル303,ドル303,ドル303,ドル303,ドル303ドル),
 {78:'N'} (303,ドル383,ドル343,ドル363,ドル333,ドル333,ドル31ドルB,30ドルB,307,ドル303ドル),
 {79:'O'} (1ドルFE,3ドルFF,303,ドル303,ドル303,ドル303,ドル303,ドル303,ドル3ドルFF,1ドルFE),
 {80:'P'} (3ドルFE,3ドルFF,303,ドル303,ドル3ドルFF,3ドルFE,300,ドル300,ドル300,ドル300ドル),
 {81:'Q'} (1ドルFE,3ドルFF,303,ドル303,ドル303,ドル303,ドル33ドルB,30ドルF,3ドルFE,1ドルFB),
 {82:'R'} (3ドルFE,3ドルFF,303,ドル303,ドル3ドルFF,3ドルFE,318,ドル30ドルC,306,ドル303ドル),
 {83:'S'} (1ドルFE,3ドルFF,301,ドル300,ドル3ドルFE,1ドルFF,003,ドル203,ドル3ドルFF,1ドルFE),
 {84:'T'} (3ドルFF,3ドルFF,030,ドル030,ドル030,ドル030,ドル030,ドル030,ドル030,ドル030ドル),
 {85:'U'} (303,ドル303,ドル303,ドル303,ドル303,ドル303,ドル303,ドル303,ドル3ドルFF,1ドルFE),
 {86:'V'} (303,ドル303,ドル186,ドル186,ドル186,ドル186,ドル0ドルCC,0ドルCC,078,ドル030ドル),
 {87:'W'} (303,ドル303,ドル303,ドル303,ドル333,ドル333,ドル333,ドル37ドルB,1ドルCE,186ドル),
 {88:'X'} (303,ドル186,ドル0ドルCC,078,ドル030,ドル078,ドル0ドルCC,186,ドル303,ドル303ドル),
 {89:'Y'} (303,ドル186,ドル0ドルCC,078,ドル030,ドル030,ドル030,ドル030,ドル030,ドル030ドル),
 {90:'Z'} (3ドルFF,3ドルFE,00ドルC,018,ドル030,ドル030,ドル060,ドル0ドルC0,1ドルFF,3ドルFF),
 {91:'['} (0ドルFE,0ドルFE,0ドルC0,0ドルC0,0ドルC0,0ドルC0,0ドルC0,0ドルC0,0ドルFE,0ドルFE),
 {92:'\'} (200,ドル300,ドル180,ドル0ドルC0,060,ドル030,ドル018,ドル00ドルC,006,ドル002ドル),
 {93:']'} (0ドルFE,0ドルFE,006,ドル006,ドル006,ドル006,ドル006,ドル006,ドル0ドルFE,0ドルFE),
 {94:'^'} (000,ドル000,ドル000,ドル000,ドル000,ドル000,ドル000,ドル000,ドル000,ドル000ドル) );
Var
 character: char;
 banner: str13;
 Param: array[1..4] of str80;
 InfileName, OutfileName: str80;
 Infile, Outfile: text;
 Slash_A, Slash_B, Slash_C, Slash_I, Slash_O: boolean;
{----------------------------------------------------------------------}
Procedure Beep;
begin
 Sound(350);
 Delay(300);
 NoSound;
end;
{----------------------------------------------------------------------}
Procedure UpperCase(var AnyStr: str80);
var
 i: integer;
begin
 For i := 1 to length(AnyStr) do AnyStr[i] := UpCase(AnyStr[i]);
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 [/A]] ',
 '[/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(' /A = append to file if it already exists'^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
 n, b, c, i, o: integer;
 ch1, ch2, ch3: char;
 {*} procedure Error;
 begin
 Beep;
 Print_Syntax;
 Halt;
 end;
begin { Parse }
 Slash_A := false;
 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 ['A','B','C','I','O']) then Error;
 If ch2 = 'A' then
 Slash_A := true;
 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_A and not Slash_O 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);
 If Slash_A and Exist(OutfileName)
 then Append(Outfile)
 else 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.
 

AltStyle によって変換されたページ (->オリジナル) /