Changeset 2946

Show
Ignore:
Timestamp:
04/10/08 22:53:37 (7 months ago)
Author:
ksprotte
Message:

merged contract-consistent-p from trunk to bos

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/bos/projects/bos/m2/m2.lisp

    r2892 r2946  
    239239    :cert-issued nil 
    240240    :expires (+ (get-universal-time) *manual-contract-expiry-time*))) 
     241 
     242(defmethod print-object ((object contract) stream) 
     243  (print-unreadable-object (object stream :type t :identity nil) 
     244    (format stream "ID: ~D, ~A" 
     245            (store-object-id object) 
     246            (if (contract-paidp object) "paid" "unpaid")))) 
    241247 
    242248(defun contract-p (object) 
     
    424430      (error 'allocation-areas-exhausted :numsqm m2-count)) 
    425431    contract)) 
     432 
     433(defun contract-consistent-p (contract) 
     434  (labels ((m2-points-to-contract (m2) 
     435             (eq contract (m2-contract m2)))) 
     436    (let ((consistent t)) 
     437      (unless (every #'m2-points-to-contract (contract-m2s contract))         
     438        (let ((*print-length* 5)) 
     439          (warn "~s of ~s dont point to it by M2-CONTRACT~ 
     440                 ~%either those m2s are free or point to another contract~ 
     441                 ~%the wrongly pointed to objs with duplicates removed are: ~s" 
     442                (remove-if #'m2-points-to-contract (contract-m2s contract)) 
     443                contract 
     444                (remove-duplicates (remove contract (mapcar #'m2-contract (contract-m2s contract)))))) 
     445        (setq consistent nil)) 
     446      consistent))) 
    426447 
    427448(defvar *last-contracts-cache* nil)