Linkscheck-link-definitionscheck-all-instance-linksGoTo Top

check-all-instance-links   &optional silentp errorp => problem-count[Function]

Purpose
Check the link slots of all unit instances for bi-directional consistency.

Package   :gbbopen

Module   :gbbopen-core

Arguments and values

silentp     A generalized boolean (default is nil)
errorp     A generalized boolean (default is nil)
problem-count     An integer

Returns
The number of inconsistent links encountered.

Description
GBBopen automatically maintains bidirectional relationship consistency all link-slot definitions are consistent. (Definitional consistency can be checked with check-link-definitions). Unintended destructive list modification of the value of a link slot (for example, using sort without a protective copy-list) can break this consistency. Check-all-instance-links detects link inconsistencies and, when errorp is true, assist in repairing them.

If a link inconsistency is found, details of the inconsistency are printed to *standard-output*.

If silentp is true, warning and summary messages are not printed. If silentp is nil and errorp is true, a correctable error is signaled if a link inconsistency is found.

See also
    check-link-definitions

Examples
Check that all instance links are consistent:

  > (check-all-instance-links)
  ;; All instance links are consistent.
  0
  >
Check again, silently:
  > (check-all-instance-links 't)
  0
  >

The result of checking when something has set the next-location link slot in location 20 to nil:

  > (check-all-instance-links)
  Warning: Inverse link back to #<location 21 (32 37)> (link-slot previous-location)
           from #<location 20 (28 28)> is missing in link-slot next-location
  ;; 1 problem was found.
  1
  >

Repeat, but with errorp true to prompt for automated repair of each problem:

  > (check-all-instance-links nil 't)
  Error: Inverse link back to #<location 21 (32 37)> (link-slot previous-location)
         from #<location 20 (28 28)> is missing in link-slot next-location
  Restart actions (select using :c n):
    0: Fix the inconsistency.
  >> :c 0
  ;; Link to #<location 21 (32 37)> added.
  ;; 1 problem was found.
  ;; 1 repair was made.
  1
  > (check-all-instance-links)
  ;; All instance links are consistent.
  0
  >


The GBBopen Project


Linkscheck-link-definitionscheck-all-instance-linksGoTo Top