ORIGIN '~beta/basiclib/betaenv'; BODY 'private/scanobjectsbody'; (* Support for scanning all objects at a point of time * in the execution of any BETA program. * * If you specialize the 'callback' virtual, it will be * executed once for each object visited, with 'obj' * referring to the object being visited. It will * never be executed for a non-object, such as a * repetition etc. * * The pattern variable 'root' is used to select * which objects to visit: an object is visited iff * it is an instance of a specialization of the * pattern denoted by 'root'. If 'root' is NONE, * all objects and non-objects are visited. If * (root## = object##), all objects are visited. * * If 'printVisited' is true, a message is printed * describing the pattern of each visited object, * and giving the category of each visited non-object, * such as '[Value Repetition]'. * * When 'printVisited' is true, other booleans can be * used to enhance the output for objects: If * 'printOrigin' is true, the origin of each * visited object is printed. If 'printSize' * is true, the size in bytes of each visited * object is printed. * * If a garbage collection runs during a scan, it * will be aborted with an error message, but the * program continues otherwise unaffected. To * avoid this, try to create as few objects as * possible in callback. (If callback is not * specialized, it will not get called, and no * objects will be created during the scan.) * * COPYRIGHT * Copyright Mjolner Informatics, 1994-96 * All rights reserved. *) --- LIB: attributes --- scanCallback: (# obj: ^object; enter obj[] do INNER #); scanPrefix: (# callback:< scanCallback; root: ##object; printVisited,printOrigin,printSize: @boolean; do INNER #); scanIOA: scanPrefix(# do ... #); scanAOA: scanPrefix(# do ... #); scanLVRA: scanPrefix(# do ... #); ScanRefsToPrefix: (# target: ^Object; callback:< scanCallback; printName: @Boolean; skipGC: @Boolean; (* Set to true when using within the other scans *) enter target[] do INNER #); (* Scans IOA only for references to the given target *) scanRefsToObject: ScanRefsToPrefix(# do ... #)
14.10 Scanobjects Interface | © 1994-2004 Mjølner Informatics |
[Modified: Wednesday July 29th 1998 at 17:45]
|