INTERFACE PZSegment; IMPORT Wr, Rd, PZSymbolChain; (* A segment is a part of a fragment contour *) TYPE T = RECORD k: CARDINAL; (* Contour index *) ini: CARDINAL; (* Initial sample index *) fin: CARDINAL; (* Final sample index *) END; (* A "PZSegment.T" record describes a set of one or more consecutive samples along a fragment contour. The samples in the segment have indices "[ini..fin]"; except that both indices have been reduced to the interval "[0..m)" modulo the total number of samples "m". Thus, if "fin < ini", the segment is actually "[ini..fin+m]". *) List = ARRAY OF T; ReadData = RECORD cmt: TEXT; s: REF List END; PROCEDURE Write( wr :Wr.T; cmt: TEXT; READONLY s: List; ); (* Writes the list of segments "s" to the writer "wr". *) PROCEDURE Read(rd :Rd.T): ReadData; (* Reads from "rd" a list of segments that was written by "Write". *) PROCEDURE GetCurves(READONLY s: List): REF ARRAY OF BOOLEAN; (* Returns a vector "seen" such that "seen[k]" is TRUE iff curve "k" occurs in some segment "s[i]". *) TYPE Chain = PZSymbolChain.ReadData; PROCEDURE Print ( wr: Wr.T; prefix: TEXT; READONLY s: T; READONLY chain: Chain; reverse: BOOLEAN := TRUE; ); (* Prints the segment "s" to "wr", in a readable format. If the "chain"s are not NIL, also prints the corresponding letters of the chain. Normally the chain is printed out unchanged. Specify "reverse = TRUE" to print it out reversed and complemented. *) END PZSegment.