DIRECTORY CD, Core, CoreGeometry, RefTab; Bagness: CEDAR DEFINITIONS = PUBLIC BEGIN TouchProc: TYPE = CoreGeometry.TouchProc; Transformation: TYPE = CoreGeometry.Transformation; Rect: TYPE = CD.Rect; Instance: TYPE = CoreGeometry.Instance; Instances: TYPE = CoreGeometry.Instances; Bag: TYPE = RECORD [ head, tail: Instances, bbox: Rect ]; Bags: TYPE = LIST OF Bag; BagList: TYPE = RECORD [ bags: Bags, bbox: Rect]; BagKeepProc: TYPE = PROC [bag: Bag] RETURNS [keep: BOOL _ TRUE]; BagIsNotEmpty: PROC [bag: Bag] RETURNS [BOOL]; BagTouchesInstance: PROC [bag: Bag, instance: Instance, touch: TouchProc] RETURNS [BOOL]; BagTouchesBag: PROC [bag1, bag2: Bag, touch: TouchProc] RETURNS [BOOL]; CreateBag: PROC [] RETURNS [Bag]; InsertInstance: PROC [bag: Bag, instance: Instance] RETURNS [Bag]; BagAppend: PROC [onto, from: Bag] RETURNS [Bag]; BagPrune: PROC [bag: Bag, keep: InstKeepProc] RETURNS [Bag]; TransformBag: PROC [bag: Bag, trans: Transformation] RETURNS [Bag]; InstKeepProc: TYPE = PROC [instance: Instance] RETURNS [keep: BOOL _ TRUE]; BagCount: PROC [bagList: BagList] RETURNS [NAT]; CreateBagList: PROC [] RETURNS [BagList]; InsertBag: PROC [bagList: BagList, bag: Bag] RETURNS [BagList]; TransformBagList: PROC [bagList: BagList, trans: Transformation] RETURNS [BagList]; FuseInstance: PROC [bagList: BagList, instance: Instance, touch: TouchProc] RETURNS [BagList]; FuseBagList: PROC [bagList1, bagList2: BagList, touch: TouchProc] RETURNS [BagList]; MergeBagList: PROC [bagList1, bagList2: BagList] RETURNS [BagList]; PruneInstances: PROC [bagList: BagList, keep: InstKeepProc] RETURNS [BagList]; InstTab: TYPE = RefTab.Ref; Val: TYPE = RefTab.Val; InstTabCreate: PROC [mod: NAT _ 17] RETURNS [InstTab]; InstTabFetch: PROC [instTab: InstTab, inst: Instance] RETURNS [found: BOOL, val: Val]; InstTabReplace: PROC [instTab: InstTab, inst: Instance, val: Val _ NIL] RETURNS [BOOL]; InstTabDelete: PROC [instTab: InstTab, inst: Instance] RETURNS [BOOL]; InstTabInsert: PROC [instTab: InstTab, inst: Instance, val: Val _ NIL] RETURNS [BOOL]; END. Bagness.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Bruce Wagar August 14, 1987 4:26:24 pm PDT Interface for the bagness data structures and associated routines. Bagness Information A bag is a list of CoreGeometry instances with something in common (e.g., connected). Bag Procs Decides if bag is not empty. Decides if instance touches an instance of bag. Decides if any instance of bag1 touches an instance of bag2. Returns a new empty bag. Inserts instance into bag. Destructive appending of onto and from. Deletes all instances from bag which don't satisfy keep. Doesn't update bbox. Returns a copy of bag with trans applied to each instance. Reverses order of instances. BagList Procs Returns the number of bags in bagList. Returns a new empty bagList. Inserts bag into bagList. Returns a copy of bagList with trans applied to every bag. Destructive fusion merge of instance into bagList. Destructive fusion merge of bagList1 and bagList2. Destructive merge of two disjoint bagLists (no fusion performed). Runs faster when bagList1 is shorter. Deletes all instances from bagList which don't satisfy keep. InstTab Information InstTab Procs Creates new table with suggested initial hash size. Returns TRUE and sends back associated value iff inst is in instTab. Returns TRUE after overwriting old value for existing inst-value pair. If no previous value for inst, returns FALSE without inserting new pair. Deletes inst-value pair associated with given inst. Returns TRUE if deletion actually occurred, FALSE if no such inst. Returns TRUE after inserted new pair. If previous value existed for key, returns FALSE without changing value. Κώ˜codešœ ™ Kšœ<™