Re: How to load/store procedure variables
Dominik Gruntz (gruntz@oberon.ch)
Sat, 13 Feb 1999 08:46:01 +0100
>
>Mapper* =3D PROCEDURE (a: Axis; xreal: REAL): INTEGER;
>InvMapper* =3D PROCEDURE (a: Axis; xint: INTEGER) : REAL;
>
>Axis* =3D POINTER TO RECORD
> x0, x1, delta: REAL;
> i0, i1: INTEGER;
> map*: Mapper; (** world --> view, installable *)
> inv*: InvMapper (** view --> world, installable *)
>END;
>
>Any suggestions what is the recommended way of dealing with=20
>installable behavior?=20
use objects instead of procedure variables:
Mapper* =3D POINTER TO RECORD (Stores.Store)
(m: Mapper) ConvertToView(a: Axis; x: REAL): INTEGER;
(m: Mapper) ConvertToWorld(a: Axis; x: INGEGER): REAL;
END;
Axis* =3D POINTER TO RECORD
x0, x1, delta: REAL;
i0, i1: INTEGER;
mapper*: Mapper; (** installable **)
END;
now you ca externalize the Mapper using Stores.Writer.WriteStore.
- Dominik Gruntz, Oberon microsystems AG, Switzerland