DIRECTORY GGBasicTypes, GGModelTypes, Interpress, ImagerTransformation, IO, Rope, ViewerClasses; GGUtility: CEDAR DEFINITIONS = BEGIN BitVector: TYPE = GGBasicTypes.BitVector; FeatureData: TYPE = GGModelTypes.FeatureData; Outline: TYPE = GGModelTypes.Outline; OutlineDescriptor: TYPE = GGModelTypes.OutlineDescriptor; Sequence: TYPE = GGModelTypes.Sequence; Slice: TYPE = GGModelTypes.Slice; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; Traj: TYPE = GGModelTypes.Traj; Viewer: TYPE = ViewerClasses.Viewer; StartFeatureDataList: PROC [] RETURNS [entityList, ptr: LIST OF FeatureData]; AddFeatureData: PROC [entity: FeatureData, entityList, ptr: LIST OF FeatureData] RETURNS [newList, newPtr: LIST OF FeatureData]; DeleteSequenceFromList: PROC [seq: Sequence, seqList: LIST OF Sequence] RETURNS [smallerList: LIST OF Sequence]; AppendSequenceList: PROC [list1, list2: LIST OF Sequence] RETURNS [result: LIST OF Sequence]; StartSequenceList: PROC [] RETURNS [entityList, ptr: LIST OF Sequence]; AddSequence: PROC [entity: Sequence, entityList, ptr: LIST OF Sequence] RETURNS [newList, newPtr: LIST OF Sequence]; StartList: PROC [] RETURNS [entityList, ptr: LIST OF REF ANY]; AddEntity: PROC [entity: REF ANY, entityList, ptr: LIST OF REF ANY] RETURNS [newList, newPtr: LIST OF REF ANY]; SetOfRefAny: TYPE = REF SetOfRefAnyObj; SetOfRefAnyObj: TYPE = RECORD [ count: NAT, sorted: BOOL _ FALSE, refs: SEQUENCE maxCount: NAT OF REF ANY ]; EmptySet: PROC [] RETURNS [set: SetOfRefAny]; AddToSet: PROC [entity: REF ANY, set: SetOfRefAny]; SizeOfSet: PROC [set: SetOfRefAny] RETURNS [count: NAT]; FetchSetElement: PROC [set: SetOfRefAny, index: NAT] RETURNS [entity: REF ANY]; DeleteFromSet: PROC [index: NAT, set: SetOfRefAny]; SortSet: PROC [set: SetOfRefAny, orderProc: OrderProc]; OrderProc: TYPE = PROC [e1, e2: REF ANY] RETURNS [e1GoesBeforeE2: BOOL]; AppendNATs: PROC [list1, list2: LIST OF NAT] RETURNS [result: LIST OF NAT]; StartNATList: PROC [] RETURNS [entityList, ptr: LIST OF NAT]; StartTrajList: PROC [] RETURNS [entityList, ptr: LIST OF Traj]; StartSDList: PROC [] RETURNS [entityList, ptr: LIST OF SliceDescriptor]; StartOutlineList: PROC [] RETURNS [entityList, ptr: LIST OF Outline]; StartSliceList: PROC [] RETURNS [entityList, ptr: LIST OF Slice]; AddNAT: PROC [entity: NAT, entityList, ptr: LIST OF NAT] RETURNS [newList, newPtr: LIST OF NAT]; AddTraj: PROC [entity: Traj, entityList, ptr: LIST OF Traj] RETURNS [newList, newPtr: LIST OF Traj]; AddSD: PROC [entity: SliceDescriptor, entityList, ptr: LIST OF SliceDescriptor] RETURNS [newList, newPtr: LIST OF SliceDescriptor]; AddOutline: PROC [entity: Outline, entityList, ptr: LIST OF Outline] RETURNS [newList, newPtr: LIST OF Outline]; AddSlice: PROC [entity: Slice, entityList, ptr: LIST OF Slice] RETURNS [newList, newPtr: LIST OF Slice]; BreakIntervalMOD: PROC [start, end, mod: NAT] RETURNS [s1, e1, s2, e2: INT]; BreakIntervalMODLen: PROC [start, len, mod: NAT] RETURNS [s1, len1, s2, len2: INT]; InMODRegion: PROC [test: NAT, start, end, mod: NAT] RETURNS [BOOL]; AllFalse: PROC [bitvec: BitVector] RETURNS [BOOL]; AllTrue: PROC [bitvec: BitVector] RETURNS [BOOL]; plusInfinity: REAL = 1E16; minusInfinity: REAL = -1E16; epsilonInPoints: REAL = 7.2E-4; epsilonInInches: REAL = 1.0E-5; GetGargoyleFileName: PROC [ggName: Rope.ROPE, currentWDir: Rope.ROPE, feedback: Viewer, emergency: BOOL _ FALSE] RETURNS [fullName: Rope.ROPE _ NIL, success: BOOL _ TRUE, versionSpecified: BOOL _ FALSE]; GetInterpressFileName: PROC [ipName: Rope.ROPE, currentWDir: Rope.ROPE, feedback: Viewer] RETURNS [fullName: Rope.ROPE _ NIL, success: BOOL _ TRUE]; GetScriptFileName: PROC [scriptName: Rope.ROPE, currentWDir: Rope.ROPE, feedback: Viewer] RETURNS [fullName: Rope.ROPE _ NIL, success: BOOL _ TRUE]; OpenInterpressOrComplain: PROC [feedback: Viewer, fullName: Rope.ROPE] RETURNS [ipMaster: Interpress.Master, success: BOOL]; END. ΤGGUtility.mesa Copyright c 1986 by Xerox Corporation. All rights reserved. Last edited by Bier on January 30, 1987 8:34:13 pm PST. Contents: General Purpose routines for use by Gargoyle. Pier, February 12, 1987 8:14:33 pm PST Operations on LIST OF FeatureData Operations on LIST OF Sequence Operations on LIST OF REF ANY Two Finger List Constructor Operations on a Set of REF ANY Operations on Assorted LIST Types Modular Arithmetic Given an interval of a circular buffer whose elements are numbered 0 .. mod -1, we break up the interval into one or two pieces, neither of which crosses the mod-1 to 0 boundary. Examples: BreakIntervalMOD[6, 2, 7] => [6, 6, 0, 2]; BreakIntervalMOD[2, 6, 7] => [2, 6, -1, -1]; Lile BreakIntervalMOD except that both the original interval and the results are expressed in the form (start of interval, length of interval) instead of [start..end]. Non-destructive (copies the first list). Operations on Bit Vectors Operations on REAL For algorithms that need a variable initialized to an impossibly large number. Unfortunately, Real.PlusInfinity can't be compared with anything. These sizes were chosen so that they can be scaled by 1000 and squared once without causing overflow. (Many geometric algorithms work with distance squared to keep from doing square roots) Gargoyle guarantees accuracy to within 0.001 inches, or 0.072 screen dots. Allowing two orders of magnitude leeway gives 10-5 inches or 7.2 * 10-4 screen dots. FileNames Κ:˜code™Kšœ Οmœ1™KšŸ œžœ žœžœžœžœžœžœžœžœžœžœžœ˜oK˜Kšœ™K™Kšœ žœžœ˜'šœžœžœ˜Kšœžœ˜ Kšœžœžœ˜Kš œžœ žœžœžœž˜'K˜K˜—KšŸœžœžœ˜-KšŸœžœ žœžœ˜3KšŸ œžœžœ žœ˜8Kš Ÿœžœžœžœ žœžœ˜OKšŸ œžœ žœ˜3KšŸœžœ*˜7Kš Ÿ œž œ žœžœžœžœ˜HK™Kšœ!™!K˜KšŸ œžœžœžœžœžœ žœžœžœ˜KK˜Kš Ÿ œžœžœžœžœžœ˜=Kš Ÿ œžœžœžœžœ˜?Kš Ÿ œžœžœžœžœ˜HKš Ÿœžœžœžœžœ ˜EKš Ÿœžœžœžœžœ˜AK˜KšŸœžœ žœžœžœžœžœžœžœžœ˜`KšŸœžœ!žœžœžœžœžœ˜dKšŸœžœ,žœžœžœžœžœ˜ƒKšŸ œžœ$žœžœ žœžœžœ ˜pKšŸœžœ"žœžœžœžœžœ˜hK˜Kšœ™K™š Ÿœžœžœžœžœ˜LK™²Kšœ5™5Kšœ,™,—š Ÿœžœžœžœžœ˜SKšœ§™§—š Ÿ œžœžœžœžœžœ˜CK™(K™—šœ™K˜—KšŸœžœžœžœ˜2KšŸœžœžœžœ˜1K˜šœ™K™KšœΠ™Π—Kšœžœ˜šœžœ ˜Kšœ|Οuœ‘œ ™ —Kšœžœ ˜Kšœžœ ˜K˜™ K™—KšŸœžœžœžœžœžœžœžœžœ žœžœžœžœ˜ΛKšŸœžœžœžœžœžœžœ žœžœ˜”KšŸœžœžœžœžœžœžœ žœžœ˜”Kš Ÿœžœ#žœžœ(žœ˜|K˜Kšžœ˜K˜—…—LZ