home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug017.arc
/
WB-ESC.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
6KB
|
158 lines
WORDBEE_FILE_CONVERTER.
B∙ Steveε Jepson.
Thi≤á prograφá wa≤ writteε fo≥ peoplσ wh∩ havσ ß disδ systeφá anΣá usσ ì
Wordbeσ a≤ thei≥ Editor«á Wordbeσ ha≤ thσ advantagσ oµ allowinτ yo⌡ t∩á usσ ì
al∞ oµ you≥ printer'≤ escapσ codes« However¼ t∩ usσ thi≤ facility¼ yo⌡ mus⌠ ì
jum≡á t∩á thσá monitor╗á manuall∙á inser⌠á thσá escapσá character≤á iεá thσ ì
appropriatσ places╗ jum≡ bacδ t∩ wordbeσ anΣ savσ thσ file« Thi≤ i≤ ß mess∙ ì
procedurσ whicΦ caε producσ BDO╙ error≤ unles≤ grea⌠ carσ i≤ takeε and¼ fo≥ ì
thσ novice¼ thi≤ i≤ aε almos⌠ impossiblσ task.
T∩á usσá thi≤ prograφ ß certaiε characte≥ i≤ pu⌠ iε thσá Wordbeσá filσ ì
(usinτá WordBee⌐á wherσá thσá Escape≤ arσ wanteΣá (thi≤á characte≥á caεá bσ ì
determineΣá b∙ thσ use≥ a⌠ compilatioε anΣ i⌠ i≤ currentl∙ se⌠ a⌠ `^'⌐ Wheε ì
thσá prograφá i≤ theε ruε al∞ thσ `^'≤ arσ converteΣ t∩á Escapσá character≤ ì
whicΦ wil∞ appea≥ a≤ ß O'≤ witΦ horizonta∞ line≤ througΦ thσ middle«á Thesσ ì
caεá bσá deleteΣ iε WordBeσ bu⌠ caε no⌠ bσ created¼á s∩ iµ b∙á acciden⌠á aε ì
escapσá i≤ deleted¼á anothe≥ `^º shoulΣ bσ addeΣ anΣ thσ filσá ruεá througΦ ì
thi≤ prograφ again.
Thσ prograφ wil∞ producσ ß backu≡ filσ oµ thσ filσ i⌠ i≤ convertinτ s∩ ì
that¼á iµ ß mistakσ i≤ made¼ thσ filσ caε bσ retrieved« I⌠ wil∞ als∩ deletσ ì
thσ olΣ backu≡ filσ beforσ thσ ne≈ onσ i≤ made¼á thi≤ wil∞ sto≡ yo⌡á havinτ ì
1░ olΣ backu≡ files.
Thσá prograφ wil∞ looδ oε thσ curren⌠ drivσ fo≥ thσ filσ unles≤ ß disδ ì
namσá i≤á giveεá iεá thσ filename«á D∩ no⌠ adΣá thσá filetypσá `.WBFºá wheε ì
specifyinτ thσ filenamσ a≤ thσ prograφ add≤ thi≤ itself.
Thσá codσá i≤á iε Turb∩ Pasca∞ anΣ wil∞ havσ t∩ bσá compileΣá t∩á disδ ì
becausσ oµ thσ sizσ oµ thσ buffe≥ array« Therσ wil∞ bσ ß cop∙ oµ thσ objec⌠ ì
codσ anΣ sourcσ codσ oε thσ club'≤ RCPM¼ and¼ iµ i⌠ i≤ no⌠ possiblσ fo≥ yo⌡ ì
t∩á ge⌠ ß cop∙ ofµ thσ RCPM¼á ß cop∙ wil∞ bσ pu⌠ iε thσ tapσá librar∙á witΦ ì
botΦá file≤á oεá it«á (Thesσ wil∞ onl∙ bσ fo≥ disδ systems.⌐ Thσá filσá i≤ ì
commenteΣ anΣ iµ therσ arσ an∙ problem≤ witΦ thσ prograφ yo⌡ caε seσ mσá a⌠ ì
thσ nex⌠ meetinτ o≥ leavσ message≤ oε thσ RBBS.
Iµá yo⌡á don'⌠ usσ WordBeσ thσ prograφ coulΣ bσá modifieΣá t∩á perforφ ì
task≤ sucΦ a≤ filσ compactinτ o≥ filσ copying.
Thσ_Program.
Prograφ Wordbee_ESC_Converter;
const
Name_lengtΦ ╜ 14;
Bufsizσ ╜ 250;
Bufbytesizσ ╜ 32000;
Change_cha≥ ╜ 94╗ √ ▐ }
Type
Namσ ╜ String[Name_length]╗ √ T∩ savσ filename≤ iε }
Var
Filename : Name; { Where the filename is kept}
Master_File,
New_File : File; { File variables }
è { Buffer is where Blockread and Blockwrite keep the
information which has been read from the file }
Buffer : Array[1..Bufbytesize] of Byte;
Recs_To_Read,
Remaining,
I : Integer;
No_Error : Boolean;
Function Exist(Filename :Name) :Boolean;
{ Finds if the file already exists on the Disk. }
{ If so returns TRUE. }
var
Fil : file;
Begin
Assign(Fil,Filename);
{$I-} Reset(fil) {$I+}; { Errors are captured not reported }
if IOresult <> 0 then Exist := False else Exist := True;
end;
Begin
ClrScr;
Writeln('WordBee ESC Converter.':52);
writeln('~~~~~~~~~~~~~~~~~~~~~~':52);
Writeln(' By S.Jepson 20/1/85':78);
Writeln;Writeln;writeln;
Write('This Program will find a certain Character ');
Writeln('and convert it to the ESC character');
Write('in the Wordbee file. It also produces a Backup of ');
writeln('the original file.');
Writeln;writeln;writeln;writeln;
Writeln('Enter the name of the WordBee file , only the name.');
Writeln;
Write('eg ''FRED'' NOT ''FRED.WBF'' Filename :');
Filename:=' ' ;
Readln(Filename);
{ Change to Upper Case }
For I := 1 to Name_length do
Filename[I] := UpCase(Filename[I]);
IF Exist(Filename+'.WBF') { See if file is on disk}
Then
Begin
If Exist(Filename+'.BAK') { erase old backup}
then begin
Assign(New_File,Filename+'.BAK');
Erase(New_File);
end;
Assign(Master_File,Filename+'.WBF'); {Create a backup }
Rename(Master_File,Filename+'.BAK'); {file of masterfile}
Assign(New_File,Filename+'.WBF'); {Open newfile in the }
{ oldfiles name }è Rewrite(New_File); { clear the new file }
Reset(Master_File); { point to start of master file }
No_Error := True; { there are no errors }
Remaining := Filesize(Master_File); {what is size of file}
While ( Remaining > 0 ) and No_Error do {do until EOF }
Begin
{ how much can we read from master file ?? }
If Bufsize <= Remaining Then
Recs_To_Read := Bufsize
Else
Recs_To_Read := Remaining;
{ Read the block of file and disable I/O errors }
{$I-} Blockread(Master_File,Buffer,Recs_To_Read) {$I+};
{ If there was an error then EOF has occurred }
If Ioresult <> 0 Then No_Error := False;
{ Change all `change_char's to ESC }
For I:=1 To Recs_To_Read*128 do
If Buffer[I] = Change_Char Then Buffer[I]:= 27;
{ Write the changed block of file to new file }
Blockwrite(New_File,Buffer,Recs_To_Read);
{ How much of Master File is left to read }
Remaining := Remaining - Recs_To_Read;
End; {of while loop}
Close(Master_File); {close files}
Close(New_File);
End {of if then}
Else {File does not exist. Produce Error.}
begin
writeln;writeln;
Writeln('..FILE_ERROR.. File ',filename,'.WBF does not exist.');
end;
End. { of program }