Changeset 16148 in project


Ignore:
Timestamp:
10/07/09 22:52:11 (10 years ago)
Author:
Kon Lovett
Message:

Fix for synch variants

Location:
release/4/lookup-table
Files:
4 edited
7 copied

Legend:

Unmodified
Added
Removed
  • release/4/lookup-table/tags/1.11.2/lookup-table-synch.scm

    r16134 r16148  
    66(module lookup-table-synch (;export
    77  make-dict/synch
     8  alist->dict/synch
    89  dict?/synch
    9   alist->dict/synch
    1010  dict->alist/synch
    11   dict?/synch
    1211  dict-equivalence-function/synch
    1312  dict-count/synch
     
    3433
    3534(define-constructor/synch make-dict dict/synch:)
     35(define-constructor/synch alist->dict)
    3636
    3737(define-predicate/synch dict?)
    3838
    39 (define-operation/synch alist->dict)
    4039(define-operation/synch dict->alist)
    41 (define-operation/synch dict?)
    4240(define-operation/synch dict-equivalence-function)
    4341(define-operation/synch dict-count)
     
    5452(define-operation/synch dict-for-each)
    5553(define-operation/synch dict-search)
    56 (define-operation/synch dict-merge!)
     54(define (dict-merge!/synch mtxtbl1 mtxtbl2)
     55  (let/synch ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
     56    (dict-merge! tbl1 tbl2) ) )
    5757(define-operation/synch dict-print)
    5858
  • release/4/lookup-table/tags/1.11.2/lookup-table-unsafe-synch.scm

    r16134 r16148  
    66(module lookup-table-unsafe-synch (;export
    77  make-dict/synch
     8  alist->dict/synch
    89  dict?/synch
    9   alist->dict/%synch
    1010  dict->alist/%synch
    11   dict?/%synch
    1211  dict-equivalence-function/%synch
    1312  dict-count/%synch
     
    3433
    3534
    36 (define-constructor/synch make-dict dict/%synch:)
     35(define-constructor/synch make-dict dict/synch:)
     36(define-constructor/synch alist->dict dict/synch:)
    3737
    3838(define-predicate/synch dict?)
    3939
    40 (define-operation/%synch alist->dict)
    4140(define-operation/%synch dict->alist)
    42 (define-operation/%synch dict?)
    4341(define-operation/%synch dict-equivalence-function)
    4442(define-operation/%synch dict-count)
     
    5553(define-operation/%synch dict-for-each)
    5654(define-operation/%synch dict-search)
    57 (define-operation/%synch dict-merge!)
     55(define (dict-merge!/%synch mtxtbl1 mtxtbl2)
     56  (%let/synch ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
     57    (dict-merge! tbl1 tbl2) ) )
    5858(define-operation/%synch dict-print)
    5959
  • release/4/lookup-table/tags/1.11.2/tests/safe-synch.scm

    r16134 r16148  
    3232 
    3333      (let ((tbl2 (dict-update-dict!/synch tbl1 'dict)))
    34         (test-assert (dict?/synch (dict-ref/synch tbl1 'dict)))
    3534        (test tbl2 (dict-ref/synch tbl1 'dict))
    3635        (test tbl2 (dict-update-dict!/synch tbl1 'dict)) ) )
  • release/4/lookup-table/tags/1.11.2/tests/unsafe-synch.scm

    r16134 r16148  
    1616        (allen (length al)))
    1717
    18     (let ((tbl1 (alist->dict/%synch (list-copy al) tst)))
     18    (let ((tbl1 (alist->dict/synch (list-copy al) tst)))
    1919 
    20       (test-assert (dict?/%synch tbl1))
     20      (test-assert (dict?/synch tbl1))
    2121      (test tst (dict-equivalence-function/%synch tbl1))
    2222 
     
    3232 
    3333      (let ((tbl2 (dict-update-dict!/%synch tbl1 'dict)))
    34         (test-assert (dict?/%synch (dict-ref/%synch tbl1 'dict)))
    3534        (test tbl2 (dict-ref/%synch tbl1 'dict))
    3635        (test tbl2 (dict-update-dict!/%synch tbl1 'dict)) ) )
    3736 
    38     (let ((tbl (alist->dict/%synch (list-copy al) tst)))
    39       (test-assert (begin (dict-merge!/%synch tbl (alist->dict/%synch '((off . rab) (baz . pob)) tst)) #t))
     37    (let ((tbl (alist->dict/synch (list-copy al) tst)))
     38      (test-assert (begin (dict-merge!/%synch tbl (alist->dict/synch '((off . rab) (baz . pob)) tst)) #t))
    4039      (test (+ allen 1) (dict-count/%synch tbl))
    4140      (test foodat (dict-ref/%synch tbl 'foo))
     
    4847(define (dict-ht-test)
    4948        ; make sure not a hash-table rep initially
    50   (let ((tbl1 (make-dict/%synch equal? 0)))
     49  (let ((tbl1 (make-dict/synch equal? 0)))
    5150
    5251    (do ([i 0 (add1 i)])
     
    6059    (test-assert (not (dict-ref/%synch tbl1 "20")))
    6160
    62     (test-assert (begin (dict-merge!/%synch tbl1 (alist->dict/%synch '((foo . bar) (baz . bop)) equal?)) #t))
     61    (test-assert (begin (dict-merge!/%synch tbl1 (alist->dict/synch '((foo . bar) (baz . bop)) equal?)) #t))
    6362
    6463    (test 'bop (dict-ref/%synch tbl1 'baz))
  • release/4/lookup-table/trunk/lookup-table-synch.scm

    r16134 r16148  
    66(module lookup-table-synch (;export
    77  make-dict/synch
     8  alist->dict/synch
    89  dict?/synch
    9   alist->dict/synch
    1010  dict->alist/synch
    11   dict?/synch
    1211  dict-equivalence-function/synch
    1312  dict-count/synch
     
    3433
    3534(define-constructor/synch make-dict dict/synch:)
     35(define-constructor/synch alist->dict)
    3636
    3737(define-predicate/synch dict?)
    3838
    39 (define-operation/synch alist->dict)
    4039(define-operation/synch dict->alist)
    41 (define-operation/synch dict?)
    4240(define-operation/synch dict-equivalence-function)
    4341(define-operation/synch dict-count)
     
    5452(define-operation/synch dict-for-each)
    5553(define-operation/synch dict-search)
    56 (define-operation/synch dict-merge!)
     54(define (dict-merge!/synch mtxtbl1 mtxtbl2)
     55  (let/synch ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
     56    (dict-merge! tbl1 tbl2) ) )
    5757(define-operation/synch dict-print)
    5858
  • release/4/lookup-table/trunk/lookup-table-unsafe-synch.scm

    r16134 r16148  
    66(module lookup-table-unsafe-synch (;export
    77  make-dict/synch
     8  alist->dict/synch
    89  dict?/synch
    9   alist->dict/%synch
    1010  dict->alist/%synch
    11   dict?/%synch
    1211  dict-equivalence-function/%synch
    1312  dict-count/%synch
     
    3433
    3534
    36 (define-constructor/synch make-dict dict/%synch:)
     35(define-constructor/synch make-dict dict/synch:)
     36(define-constructor/synch alist->dict dict/synch:)
    3737
    3838(define-predicate/synch dict?)
    3939
    40 (define-operation/%synch alist->dict)
    4140(define-operation/%synch dict->alist)
    42 (define-operation/%synch dict?)
    4341(define-operation/%synch dict-equivalence-function)
    4442(define-operation/%synch dict-count)
     
    5553(define-operation/%synch dict-for-each)
    5654(define-operation/%synch dict-search)
    57 (define-operation/%synch dict-merge!)
     55(define (dict-merge!/%synch mtxtbl1 mtxtbl2)
     56  (%let/synch ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
     57    (dict-merge! tbl1 tbl2) ) )
    5858(define-operation/%synch dict-print)
    5959
  • release/4/lookup-table/trunk/tests/safe-synch.scm

    r16134 r16148  
    3232 
    3333      (let ((tbl2 (dict-update-dict!/synch tbl1 'dict)))
    34         (test-assert (dict?/synch (dict-ref/synch tbl1 'dict)))
    3534        (test tbl2 (dict-ref/synch tbl1 'dict))
    3635        (test tbl2 (dict-update-dict!/synch tbl1 'dict)) ) )
  • release/4/lookup-table/trunk/tests/unsafe-synch.scm

    r16134 r16148  
    1616        (allen (length al)))
    1717
    18     (let ((tbl1 (alist->dict/%synch (list-copy al) tst)))
     18    (let ((tbl1 (alist->dict/synch (list-copy al) tst)))
    1919 
    20       (test-assert (dict?/%synch tbl1))
     20      (test-assert (dict?/synch tbl1))
    2121      (test tst (dict-equivalence-function/%synch tbl1))
    2222 
     
    3232 
    3333      (let ((tbl2 (dict-update-dict!/%synch tbl1 'dict)))
    34         (test-assert (dict?/%synch (dict-ref/%synch tbl1 'dict)))
    3534        (test tbl2 (dict-ref/%synch tbl1 'dict))
    3635        (test tbl2 (dict-update-dict!/%synch tbl1 'dict)) ) )
    3736 
    38     (let ((tbl (alist->dict/%synch (list-copy al) tst)))
    39       (test-assert (begin (dict-merge!/%synch tbl (alist->dict/%synch '((off . rab) (baz . pob)) tst)) #t))
     37    (let ((tbl (alist->dict/synch (list-copy al) tst)))
     38      (test-assert (begin (dict-merge!/%synch tbl (alist->dict/synch '((off . rab) (baz . pob)) tst)) #t))
    4039      (test (+ allen 1) (dict-count/%synch tbl))
    4140      (test foodat (dict-ref/%synch tbl 'foo))
     
    4847(define (dict-ht-test)
    4948        ; make sure not a hash-table rep initially
    50   (let ((tbl1 (make-dict/%synch equal? 0)))
     49  (let ((tbl1 (make-dict/synch equal? 0)))
    5150
    5251    (do ([i 0 (add1 i)])
     
    6059    (test-assert (not (dict-ref/%synch tbl1 "20")))
    6160
    62     (test-assert (begin (dict-merge!/%synch tbl1 (alist->dict/%synch '((foo . bar) (baz . bop)) equal?)) #t))
     61    (test-assert (begin (dict-merge!/%synch tbl1 (alist->dict/synch '((foo . bar) (baz . bop)) equal?)) #t))
    6362
    6463    (test 'bop (dict-ref/%synch tbl1 'baz))
Note: See TracChangeset for help on using the changeset viewer.