Data update

This commit is contained in:
Ingy dot Net 2024-04-19 16:56:29 -07:00
parent 0df55f9f24
commit aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions

View file

@ -23,23 +23,19 @@ const proc: writeAscii (inout file: outFile, inout integer: bitPos, in string: a
const proc: finishWriteAscii (inout file: outFile, inout integer: bitPos) is func
begin
putBitsMsb(outFile, bitPos, 0, 7); # Write a terminating NUL char.
write(outFile, chr(ord(outFile.bufferChar)));
end func;
const proc: initReadAscii (inout file: outFile, inout integer: bitPos) is func
begin
bitPos := 8;
end func;
const func string: readAscii (inout file: inFile, inout integer: bitPos, in integer: length) is func
const func string: readAscii (inout msbBitStream: aBitStream) is func
result
var string: stri is "";
local
var char: ch is ' ';
begin
while not eof(inFile) and length(stri) < length do
ch := chr(getBitsMsb(inFile, bitPos, 7));
if inFile.bufferChar <> EOF then
while ch <> '\0;' do
ch := chr(getBits(aBitStream, 7));
if ch <> '\0;' then
stri &:= ch;
end if;
end while;
@ -49,12 +45,13 @@ const proc: main is func
local
var file: aFile is STD_NULL;
var integer: bitPos is 0;
var msbBitStream: aBitStream is msbBitStream.value;
begin
aFile := openStrifile;
aFile := openStriFile;
initWriteAscii(aFile, bitPos);
writeAscii(aFile, bitPos, "Hello, Rosetta Code!");
finishWriteAscii(aFile, bitPos);
seek(aFile, 1);
initReadAscii(aFile, bitPos);
writeln(literal(readAscii(aFile, bitPos, 100)));
aBitStream := openMsbBitStream(aFile);
writeln(literal(readAscii(aBitStream)));
end func;