|
|
DataMuseum.dkPresents historical artifacts from the history of: Bogika Butler |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Bogika Butler Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 2816 (0xb00)
Types: TextFile
Names: »TXTCONV.SA«
└─⟦e12db5ad4⟧ Bits:30009789/_.ft.Ibm2.50007357.imd Mogens Pelles Zilog 80,000 / EOS projekt
└─⟦this⟧ »TXTCONV.SA«
program TXTCONV (input,output);
æ* TXTCONV Version 00.02, 83-11-17 changed by EAR *å
æ**************************************************************å
æ
This program converts a versados text file to a contiguous file
Change history:
vers. 00.01, 83-11-15, EAR zero-fill last block
vers. 00.02, 83-11-17, EAR index error in zero-fill
å
type
name = stringÆ50Å;
line = stringÆ80Å;
byte = -128..127;
long = integer;
rectype = (buffer,filesize);
bufrec = record
case rectype of
buffer:
(buf: arrayÆ1..256Å of char);
filesize:
(dummy: arrayÆ1..252Å of char;
filelength: long);
end;
var
sourcename,
destname: name;
inp: text;
outp: file of bufrec;
data: bufrec;
num: packed arrayÆ1..4Å of char;
charcount,segmcount: integer;
i, j : integer;
ch: char;
procedure readuppercase(txt: line; var fname: name);
var i: integer;
begin
writeln(txt);
readln(fname);
for i := 1 to length(fname) do
if (fnameÆiÅ >= 'a') and (fnameÆiÅ <= 'z') then
fnameÆiÅ := chr(ord(fnameÆiÅ) + ord('A') - ord('a'));
end;
begin (* main program *)
readuppercase('source filename ? ',sourcename);
writeln(sourcename);
readuppercase('destination filename ?',destname);
writeln(destname);
(* find length of file *)
reset(inp,sourcename);
charcount := 0;
while not eof(inp) do
begin
read(inp,ch);
charcount := charcount + 1;
end;
writeln('charcount = ',charcount);
segmcount := (charcount + 4) div 256;
i := (charcount + 4) mod 256;
if i <> 0 then
segmcount := segmcount + 1;
writeln('segmcount = ',segmcount);
num := '1234';
for i := 4 downto 1 do
begin
numÆiÅ := chr ((segmcount mod 10) + ord ('0'));
segmcount := segmcount div 10;
end;
writeln('num = ',num);
reset(inp,sourcename);
destname := concat(destname,';C=');
for i:= 1 to 4 do
destname:= concat(destname,numÆiÅ);
rewrite (outp,destname);
i:= 1;
while not eof(inp) do
begin
if eoln(inp) then
begin
data.bufÆiÅ:= chr(10);
readln(inp);
end
else
read(inp,data.bufÆiÅ);
i := i + 1;
if i = 257 then
begin
write(outp,data);
i := 1;
writeln('buffer written');
end;
end; (* eof loop *)
for j := i to 256 do data.bufÆjÅ := chr(0);
if i <= 253 then (* fill in the length *)
data.filelength := charcount
else
begin
write(outp,data);
for j := 1 to 252 do data.dummyÆjÅ := chr(0);
data.filelength := charcount;
end;
write(outp,data);
end. (* program *)
«eof»