}
-void Files__Set_(Files__Rider_ *r, const OBNC_Td *rTD, Files__File_ f, OBNC_INTEGER pos)
+void Files__SetPos_(Files__Rider_ *r, const OBNC_Td *rTD, Files__File_ f, OBNC_INTEGER pos)
{
OBNC_C_ASSERT(r != NULL);
OBNC_C_ASSERT(f != NULL);
end GetDate;
- procedure Set*(var r: Rider; f: File; pos: Int);
+ procedure SetPos*(var r: Rider; f: File; pos: Int);
(**sets the rider r to position pos in file f. The field r.eof is set to false. The
operation requires that 0 <= pos <= Length(f)*)
- end Set;
+ end SetPos;
procedure Pos*(var r: Rider): Int;
end ReadString;
- procedure ReadSet*(var r: Rider; var s: SET);
+ procedure ReadSet*(var r: Rider; var s: Set);
(**reads a set s from rider r and advances r accordingly*)
end ReadSet;
end WriteString;
- procedure WriteSet*(var r: Rider; s: SET);
+ procedure WriteSet*(var r: Rider; s: Set);
(**writes the set s to rider r and advances r accordingly*)
end WriteSet;
f := Files.New("RegisterTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.Write(r, 37);
Files.Close(f);
Files.Register(f);
begin
f := Files.New("CloseTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.Write(r, 65);
ASSERT(Files.Length(f) <= 1);
Files.Close(f);
begin
f := Files.New("PurgeTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.Write(r, 65);
Files.Purge(f);
ASSERT(Files.Length(f) = 0)
end TestDate;
- procedure TestSet;
+ procedure TestSetPos;
var f: Files.File;
r: Files.Rider;
begin
f := Files.New("SetTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
ASSERT(~r.eof)
- end TestSet;
+ end TestSetPos;
procedure TestPos;
begin
f := Files.New("PosTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
ASSERT(Files.Pos(r) = 0)
end TestPos;
begin
f := Files.New("BaseTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
ASSERT(Files.Base(r) = f)
end TestBase;
begin
f := Files.New("ReadWriteTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.Write(r, 65);
Files.Close(f);
ASSERT(Files.Length(f) = 1);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.Read(r, b);
ASSERT(~r.eof);
ASSERT(b = 65);
f := Files.New("ReadWriteIntTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteInt(r, 100);
Files.WriteInt(r, -1000);
Files.Close(f);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadInt(r, i);
ASSERT(~r.eof);
ASSERT(i = 100);
f := Files.New("ReadWriteRealTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteReal(r, 3.14);
Files.WriteReal(r, -3.14);
Files.Close(f);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadReal(r, x);
ASSERT(~r.eof);
ASSERT(ABS(x - 3.14) < 1.0E-6);
f := Files.New("ReadWriteNumTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteNum(r, 100);
Files.WriteNum(r, -1000);
Files.Close(f);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadNum(r, i);
ASSERT(~r.eof);
ASSERT(i = 100);
f := Files.New("ReadWriteStringTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteString(r, "hello");
Files.WriteString(r, "there");
Files.WriteString(r, "");
Files.Close(f);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadString(r, s);
ASSERT(~r.eof);
ASSERT(s = "hello");
procedure TestReadWriteSet;
var f: Files.File;
r: Files.Rider;
- s: SET;
+ s: Set;
begin
f := Files.New("ReadWriteSetTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteSet(r, {});
Files.WriteSet(r, {0});
Files.WriteSet(r, {0, 1});
Files.Close(f);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadSet(r, s);
ASSERT(~r.eof);
ASSERT(s = {});
f := Files.New("ReadWriteBoolTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteBool(r, true);
Files.WriteBool(r, false);
Files.Close(f);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadBool(r, b);
ASSERT(~r.eof);
ASSERT(b);
f := Files.New("ReadWriteBytesTest");
ASSERT(f # nil);
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.WriteBytes(r, buf, LEN(buf));
Files.WriteBytes(r, buf, LEN(buf));
Files.Close(f);
for i := 0 to LEN(buf) - 1 do buf[i] := 0 end;
- Files.Set(r, f, 0);
+ Files.SetPos(r, f, 0);
Files.ReadBytes(r, buf, LEN(buf));
ASSERT(~r.eof);
if SYSTEM.SIZE(Int) >= 4 then
TestDate
end;
- TestSet;
+ TestSetPos;
TestPos;
TestBase;
TestReadWrite;
(**returns (and removes) the next character from the keyboard buffer. If the buffer is empty, Read waits until a key is pressed.*)
end Read;
- procedure Mouse*(var keys: SET; var x, y: Int);
+ procedure Mouse*(var keys: Set; var x, y: Int);
(**returns the current mouse position (x, y) in pixels relative to the lower left corner of the screen. keys is the set of the currently pressed mouse keys (left = 2, middle = 1, right = 0).*)
end Mouse;
procedure TestButton(button: Int);
var buttonLabels: array 3, 8 of Char;
- buttons: SET; x, y: Int;
+ buttons: Set; x, y: Int;
begin
buttonLabels[0] := "right";
buttonLabels[1] := "middle";
var
x, y: Int;
- keys: SET;
+ keys: Set;
begin
XYplane.Open;
{"PACK", TREES_PROCEDURE_KIND, TREES_PACK_PROC},
{"ROR", TREES_PROCEDURE_KIND, TREES_ROR_PROC},
{"Real", TREES_TYPE_KIND, TREES_REAL_TYPE},
- {"SET", TREES_TYPE_KIND, TREES_SET_TYPE},
+ {"Set", TREES_TYPE_KIND, TREES_SET_TYPE},
{"UNPK", TREES_PROCEDURE_KIND, TREES_UNPK_PROC}
};
intVar*: Int;
realVar* : Real;
byteVar*: Byte;
- setVar*: SET;
+ setVar*: Set;
strVar*: String;
recVar*, recVar1: record
f*: Int
i: Int;
x: Real;
j: Byte;
- A: SET;
+ A: Set;
begin
p := null;
end IncReturnZero;
- procedure IncReturnEmpty(var x: Int): SET;
+ procedure IncReturnEmpty(var x: Int): Set;
begin
INC(x)
return {}
procedure TestSetConstructors;
var
a, b, i, j: Int;
- A: SET;
+ A: Set;
begin
a := 4;
b := 6;
i, j, n: Int;
x: Real;
y: Byte;
- A, B: SET;
+ A, B: Set;
str: array 24 of Char;
strs: array 2, 32 of Char;
t: T;
n: Int;
x: Real;
y: Byte;
- A: SET;
+ A: Set;
begin
(*booleans*)
ASSERT(true or true);
i, j, n: Int;
x: Real;
y: Byte;
- A: SET;
+ A: Set;
begin
(*booleans*)
ASSERT(true & true);
i, j, k: Int;
r: Real;
x: Byte;
- s: SET;
+ s: Set;
begin
ASSERT(ABS(-1) = 1);
ASSERT(ABS(0) = 0);
n, n1: Int;
x, x1: Real;
y, y1: Byte;
- A, A1: SET;
+ A, A1: Set;
begin
b := true;
b1 := false;
procedure TestPredeclaredProperProcedures;
const eps = 0.01;
var n, i, j: Int;
- A: SET;
+ A: Set;
x: Real;
a: array 1 of Real;
b: array 1 of Int;
r, r1: Real;
x, x1: Byte;
xs: array 2 of Byte;
- s, s1: SET;
+ s, s1: Set;
a, a1: Array;
a2: array SYSTEM.SIZE(Array) + 1 of Int;
begin