Code: Select all
MODULE IRLib;
IMPORT Out;
TYPE
camlib* = POINTER TO RECORD
freq* : INTEGER;
shutterNow* : PROCEDURE(self : camlib)
END;
CanonCam* = POINTER TO RECORD(camlib)
shutterDelayed* : PROCEDURE(self : camlib)
END;
PROCEDURE CanonShutterNow(self : CanonCam);
BEGIN
Out.String("Click now."); Out.Ln
END CanonShutterNow;
PROCEDURE CanonShutterDelayed(self : CanonCam);
BEGIN
Out.String("Delayed ... click"); Out.Ln
END CanonShutterDelayed;
PROCEDURE CanonInit*(self : CanonCam);
BEGIN
self.freq := 33;
self.shutterNow := CanonShutterNow;
self.shutterDelayed := CanonShutterDelayed
END CanonInit;
PROCEDURE CanonExample;
VAR
D5 : CanonCam;
i : INTEGER;
BEGIN
NEW(D5);
CanonInit(D5);
i := 0;
REPEAT
D5.shutterNow(D5);
D5.shutterDelayed(D5);
INC(i)
UNTIL i > 3
END CanonExample;
END IRLib.
Code: Select all
MODULE TestIRLib;
IMPORT IRLib;
PROCEDURE CanonExample;
VAR
D5 : IRLib.CanonCam;
i : INTEGER;
BEGIN
NEW(D5);
IRLib.CanonInit(D5);
i := 0;
REPEAT
D5.shutterNow(D5);
D5.shutterDelayed(D5);
INC(i)
UNTIL i > 3
END CanonExample;
END TestIRLib.
Code: Select all
Oberon-07 LPC2000 ARM Compiler v3.4.1
compiling TestIRLib
Line Col
14 22: incompatible types
formal parameter:
15 26: incompatible types
formal parameter: