-- Clipper.mesa
-- Last changed by Doug Wyatt, September 19, 1980 10:05 AM
DIRECTORY
Area USING [Handle],
Pipe USING [Handle, Sink];
Clipper: DEFINITIONS IMPORTS Pipe = {
Handle: TYPE = LONG POINTER TO Object;
State: TYPE = RECORD[in,out: BOOLEAN];
NewClipper: PROC RETURNS[Handle];
NewPipe: PROC[self: Handle, ipipe,opipe: Pipe.Handle ← Pipe.Sink[]]
RETURNS[Pipe.Handle] = INLINE {
RETURN[self.procs.NewPipe[self,ipipe,opipe]]
};
Push: PROC[self: Handle, area: Area.Handle] = INLINE {
self.procs.Push[self,area]
};
Pop: PROC[self: Handle] = INLINE {
self.procs.Pop[self]
};
Test: PROC[self: Handle] RETURNS[State] = INLINE {
RETURN[self.procs.Test[self]]
};
NewRegion: PROC[self: Handle] RETURNS[Pipe.Handle] = INLINE {
RETURN[self.procs.NewRegion[self]]
};
Copy: PROC[self: Handle] RETURNS[Handle] = INLINE {
RETURN[self.procs.Copy[self]]
};
Free: PROC[selfPtr: LONG POINTER TO Handle] = INLINE {
self: Handle=selfPtr↑; selfPtr↑←NIL; self.procs.Free[self]
};
-- Actual representation for a Clipper interface
Object: PRIVATE TYPE = RECORD [
procs: LONG POINTER TO READONLY Procs,
data: LONG POINTER TO Data
];
Procs: PRIVATE TYPE = RECORD [
NewPipe: PROC[self: Handle, ipipe,opipe: Pipe.Handle]
RETURNS[Pipe.Handle],
Push: PROC[self: Handle, area: Area.Handle],
Pop: PROC[self: Handle],
Test: PROC[self: Handle] RETURNS[State],
NewRegion: PROC[self: Handle] RETURNS[Pipe.Handle],
Copy: PROC[self: Handle] RETURNS[Handle],
Free: PROC[self: Handle]
];
Data: PRIVATE TYPE;
ClipperImpl: PROGRAM;
}.