RoseSimValueSequences.Mesa
Last Edited by: Spreitzer, May 20, 1985 10:08:04 am PDT
DIRECTORY Atom, IO, RoseEvents, RoseRun, RoseSets, RoseTypes, RoseValueSequences;
RoseSimValueSequences: CEDAR PROGRAM
IMPORTS IO, RoseEvents, RoseValueSequences
EXPORTS RoseValueSequences
= {
OPEN RoseSets, RoseTypes, RoseValueSequences;
HeaderSource: TYPE = REF HeaderSourceRep;
HeaderSourceRep: TYPE = RECORD [
nodes: Set,
stripPrefix: NamePath];
ProduceFromSimulation: PUBLIC PROC [sim: Simulation, nodes: Set, stripPrefix: NamePath ← NIL] RETURNS [p: Producer] = {
c: Consumer;
hs: HeaderSource ← NEW [HeaderSourceRep ← [nodes, stripPrefix]];
[p, c] ← CreatePipe[];
c.takeHeader[c.data, NEW [HeaderRep ← [hs, EnumerateHeader]]];
RoseEvents.AddWatcher[$Settled, [NoteSettle, c], sim];
};
NoteSettle: PROC [event: ATOM, watched, watcherData, arg: REF ANY] = {
c: Consumer ← NARROW[watcherData];
c.synch.PutChar['x];
};
EnumerateHeader: PROC [h: Header, to: HeaderEltConsumer] = {
hs: HeaderSource ← NARROW[h.data];
NoteNode: PROC [data: REF ANY, elt: REF ANY] = {
node: Node ← NARROW[elt];
to.consume[elt: [path: PathName[node], type: node.type, val: node.valPtr], data: to.data];
};
TRUSTED {hs.nodes.class.Enumerate[hs.nodes, [NIL, NoteNode]]};
};
PathName: PROC [node: Node] RETURNS [NamePath] = {RETURN [ERROR--not yet implemented--]};
}.