Changeset 35097 in project


Ignore:
Timestamp:
01/31/18 02:10:31 (7 months ago)
Author:
kon
Message:

for growl names

Location:
release/4/lookup-table/trunk
Files:
4 edited

Legend:

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

    r19347 r35097  
    11;;;; lookup-table-synch.scm
     2;;;; Kon Lovett, Jan '18
    23;;;; Kon Lovett, Sep '09
    34
     
    67(module lookup-table-synch
    78
    8   (;export
    9     make-dict/synch
    10     alist->dict/synch
    11     dict?/synch
    12     dict->alist/synch
    13     dict-equivalence-function/synch
    14     dict-count/synch
    15     dict-keys/synch
    16     dict-values/synch
    17     dict-ref/synch
    18     dict-indempotent-ref!/synch
    19     dict-set!/synch
    20     dict-exists?/synch
    21     dict-update!/synch
    22     dict-update-list!/synch
    23     dict-update-dict!/synch
    24     dict-delete!/synch
    25     dict-for-each/synch
    26     dict-search/synch
    27     dict-merge!/synch
    28     dict-print/synch)
     9(;export
     10  make-dict-synch
     11  alist->dict-synch
     12  dict?-synch
     13  dict->alist-synch
     14  dict-equivalence-function-synch
     15  dict-count-synch
     16  dict-keys-synch
     17  dict-values-synch
     18  dict-ref-synch
     19  dict-indempotent-ref!-synch
     20  dict-set!-synch
     21  dict-exists?-synch
     22  dict-update!-synch
     23  dict-update-list!-synch
     24  dict-update-dict!-synch
     25  dict-delete!-synch
     26  dict-for-each-synch
     27  dict-search-synch
     28  dict-merge!-synch
     29  dict-print-synch
     30  ;DEPRECATED
     31  make-dict/synch
     32  alist->dict/synch
     33  dict?/synch
     34  dict->alist/synch
     35  dict-equivalence-function/synch
     36  dict-count/synch
     37  dict-keys/synch
     38  dict-values/synch
     39  dict-ref/synch
     40  dict-indempotent-ref!/synch
     41  dict-set!/synch
     42  dict-exists?/synch
     43  dict-update!/synch
     44  dict-update-list!/synch
     45  dict-update-dict!/synch
     46  dict-delete!/synch
     47  dict-for-each/synch
     48  dict-search/synch
     49  dict-merge!/synch
     50  dict-print/synch)
    2951
    30   (import scheme chicken lookup-table synch)
    31 
    32   (require-library lookup-table synch)
     52(import scheme chicken)
     53(use lookup-table synch)
    3354
    3455;;; Synchronized Dictionary
    3556
    36 (define-constructor/synch make-dict dict/synch:)
    37 (define-constructor/synch alist->dict)
     57(define-constructor-synch make-dict)
     58(define-constructor-synch alist->dict)
    3859
    39 (define-predicate/synch dict?)
     60(define-predicate-synch dict?)
    4061
    41 (define-operation/synch dict->alist)
    42 (define-operation/synch dict-equivalence-function)
    43 (define-operation/synch dict-count)
    44 (define-operation/synch dict-keys)
    45 (define-operation/synch dict-values)
    46 (define-operation/synch dict-ref)
    47 (define-operation/synch dict-indempotent-ref!)
    48 (define-operation/synch dict-set!)
    49 (define-operation/synch dict-exists?)
    50 (define-operation/synch dict-update!)
    51 (define-operation/synch dict-update-list!)
    52 (define-operation/synch dict-update-dict!)
    53 (define-operation/synch dict-delete!)
    54 (define-operation/synch dict-for-each)
    55 (define-operation/synch dict-search)
    56 (define (dict-merge!/synch mtxtbl1 mtxtbl2)
    57   (let/synch ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
     62(define-operation-synch dict->alist)
     63(define-operation-synch dict-equivalence-function)
     64(define-operation-synch dict-count)
     65(define-operation-synch dict-keys)
     66(define-operation-synch dict-values)
     67(define-operation-synch dict-ref)
     68(define-operation-synch dict-indempotent-ref!)
     69(define-operation-synch dict-set!)
     70(define-operation-synch dict-exists?)
     71(define-operation-synch dict-update!)
     72(define-operation-synch dict-update-list!)
     73(define-operation-synch dict-update-dict!)
     74(define-operation-synch dict-delete!)
     75(define-operation-synch dict-for-each)
     76(define-operation-synch dict-search)
     77(define (dict-merge!-synch mtxtbl1 mtxtbl2)
     78  (let-synch-with ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
    5879    (dict-merge! tbl1 tbl2) ) )
    59 (define-operation/synch dict-print)
     80(define-operation-synch dict-print)
     81
     82;;;DEPRECATED
     83
     84(define make-dict/synch make-dict-synch)
     85(define alist->dict/synch alist->dict-synch)
     86(define dict?/synch dict?-synch)
     87(define dict->alist/synch dict->alist-synch)
     88(define dict-equivalence-function/synch dict-equivalence-function-synch)
     89(define dict-count/synch dict-count-synch)
     90(define dict-keys/synch dict-keys-synch)
     91(define dict-values/synch dict-values-synch)
     92(define dict-ref/synch dict-ref-synch)
     93(define dict-indempotent-ref!/synch dict-indempotent-ref!-synch)
     94(define dict-set!/synch dict-set!-synch)
     95(define dict-exists?/synch dict-exists?-synch)
     96(define dict-update!/synch dict-update!-synch)
     97(define dict-update-list!/synch dict-update-list!-synch)
     98(define dict-update-dict!/synch dict-update-dict!-synch)
     99(define dict-delete!/synch dict-delete!-synch)
     100(define dict-for-each/synch dict-for-each-synch)
     101(define dict-search/synch dict-search-synch)
     102(define dict-merge!/synch dict-merge!-synch)
     103(define dict-print/synch dict-print-synch)
    60104
    61105) ;module lookup-table-synch
  • release/4/lookup-table/trunk/lookup-table-unsafe-synch.scm

    r19347 r35097  
    11;;;; lookup-table-unsafe-synch.scm
     2;;;; Kon Lovett, Jan '18
    23;;;; Kon Lovett, Sep '09
    34
     
    67(module lookup-table-unsafe-synch
    78
    8   (;export
    9     make-dict/synch
    10     alist->dict/synch
    11     dict?/synch
    12     dict->alist/%synch
    13     dict-equivalence-function/%synch
    14     dict-count/%synch
    15     dict-keys/%synch
    16     dict-values/%synch
    17     dict-ref/%synch
    18     dict-indempotent-ref!/%synch
    19     dict-set!/%synch
    20     dict-exists?/%synch
    21     dict-update!/%synch
    22     dict-update-list!/%synch
    23     dict-update-dict!/%synch
    24     dict-delete!/%synch
    25     dict-for-each/%synch
    26     dict-search/%synch
    27     dict-merge!/%synch
    28     dict-print/%synch)
     9(;export
     10  make-dict-synch
     11  alist->dict-synch
     12  dict?-synch
     13  dict->alist-%synch
     14  dict-equivalence-function-%synch
     15  dict-count-%synch
     16  dict-keys-%synch
     17  dict-values-%synch
     18  dict-ref-%synch
     19  dict-indempotent-ref!-%synch
     20  dict-set!-%synch
     21  dict-exists?-%synch
     22  dict-update!-%synch
     23  dict-update-list!-%synch
     24  dict-update-dict!-%synch
     25  dict-delete!-%synch
     26  dict-for-each-%synch
     27  dict-search-%synch
     28  dict-merge!-%synch
     29  dict-print-%synch
     30  ;DEPRECATED
     31  make-dict/synch
     32  alist->dict/synch
     33  dict?/synch
     34  dict->alist/%synch
     35  dict-equivalence-function/%synch
     36  dict-count/%synch
     37  dict-keys/%synch
     38  dict-values/%synch
     39  dict-ref/%synch
     40  dict-indempotent-ref!/%synch
     41  dict-set!/%synch
     42  dict-exists?/%synch
     43  dict-update!/%synch
     44  dict-update-list!/%synch
     45  dict-update-dict!/%synch
     46  dict-delete!/%synch
     47  dict-for-each/%synch
     48  dict-search/%synch
     49  dict-merge!/%synch
     50  dict-print/%synch)
    2951
    30   (import scheme chicken lookup-table-unsafe synch)
     52(import scheme chicken)
    3153
    32   (require-library lookup-table-unsafe synch)
     54(use lookup-table-unsafe synch)
    3355
    3456;;; UnSafe Synchronized UnSafe Dictionary
    3557
    36 (define-constructor/synch make-dict dict/synch:)
    37 (define-constructor/synch alist->dict dict/synch:)
     58(define-constructor-synch make-dict)
     59(define-constructor-synch alist->dict)
    3860
    39 (define-predicate/synch dict?)
     61(define-predicate-synch dict?)
    4062
    41 (define-operation/%synch dict->alist)
    42 (define-operation/%synch dict-equivalence-function)
    43 (define-operation/%synch dict-count)
    44 (define-operation/%synch dict-keys)
    45 (define-operation/%synch dict-values)
    46 (define-operation/%synch dict-ref)
    47 (define-operation/%synch dict-indempotent-ref!)
    48 (define-operation/%synch dict-set!)
    49 (define-operation/%synch dict-exists?)
    50 (define-operation/%synch dict-update!)
    51 (define-operation/%synch dict-update-list!)
    52 (define-operation/%synch dict-update-dict!)
    53 (define-operation/%synch dict-delete!)
    54 (define-operation/%synch dict-for-each)
    55 (define-operation/%synch dict-search)
    56 (define (dict-merge!/%synch mtxtbl1 mtxtbl2)
    57   (%let/synch ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
     63(define-operation-%synch dict->alist)
     64(define-operation-%synch dict-equivalence-function)
     65(define-operation-%synch dict-count)
     66(define-operation-%synch dict-keys)
     67(define-operation-%synch dict-values)
     68(define-operation-%synch dict-ref)
     69(define-operation-%synch dict-indempotent-ref!)
     70(define-operation-%synch dict-set!)
     71(define-operation-%synch dict-exists?)
     72(define-operation-%synch dict-update!)
     73(define-operation-%synch dict-update-list!)
     74(define-operation-%synch dict-update-dict!)
     75(define-operation-%synch dict-delete!)
     76(define-operation-%synch dict-for-each)
     77(define-operation-%synch dict-search)
     78(define (dict-merge!-%synch mtxtbl1 mtxtbl2)
     79  (%let-synch-with ((tbl1 mtxtbl1) (tbl2 mtxtbl2))
    5880    (dict-merge! tbl1 tbl2) ) )
    59 (define-operation/%synch dict-print)
     81(define-operation-%synch dict-print)
     82
     83;;;DEPRECATED
     84
     85(define make-dict/synch make-dict-synch)
     86(define alist->dict/synch alist->dict-synch)
     87(define dict?/synch dict?-synch)
     88(define dict->alist/%synch dict->alist-%synch)
     89(define dict-equivalence-function/%synch dict-equivalence-function-%synch)
     90(define dict-count/%synch dict-count-%synch)
     91(define dict-keys/%synch dict-keys-%synch)
     92(define dict-values/%synch dict-values-%synch)
     93(define dict-ref/%synch dict-ref-%synch)
     94(define dict-indempotent-ref!/%synch dict-indempotent-ref!-%synch)
     95(define dict-set!/%synch dict-set!-%synch)
     96(define dict-exists?/%synch dict-exists?-%synch)
     97(define dict-update!/%synch dict-update!-%synch)
     98(define dict-update-list!/%synch dict-update-list!-%synch)
     99(define dict-update-dict!/%synch dict-update-dict!-%synch)
     100(define dict-delete!/%synch dict-delete!-%synch)
     101(define dict-for-each/%synch dict-for-each-%synch)
     102(define dict-search/%synch dict-search-%synch)
     103(define dict-merge!/%synch dict-merge!-%synch)
     104(define dict-print/%synch dict-print-%synch)
    60105
    61106) ;module lookup-table-unsafe-synch
  • release/4/lookup-table/trunk/tests/safe-synch.scm

    r34956 r35097  
    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))
    21       (test tst (dict-equivalence-function/synch tbl1))
     20      (test-assert (dict?-synch tbl1))
     21      (test tst (dict-equivalence-function-synch tbl1))
    2222
    23       (test-assert (tst foodat (dict-ref/synch tbl1 'foo)))
    24       (test-assert (begin (dict-delete!/synch tbl1 'foo) #t))
    25       (test-assert (not (dict-ref/synch tbl1 'foo)))
     23      (test-assert (tst foodat (dict-ref-synch tbl1 'foo)))
     24      (test-assert (begin (dict-delete!-synch tbl1 'foo) #t))
     25      (test-assert (not (dict-ref-synch tbl1 'foo)))
    2626
    27       (test '() (dict-update!/synch tbl1 'foo (lambda () '())))
    28       (test '(1) (dict-update!/synch tbl1 'foo void (lambda (x) (append x '(1)))))
     27      (test '() (dict-update!-synch tbl1 'foo (lambda () '())))
     28      (test '(1) (dict-update!-synch tbl1 'foo void (lambda (x) (append x '(1)))))
    2929
    30       (test '() (dict-update-list!/synch tbl1 'list))
    31       (test '(1 2) (dict-update-list!/synch tbl1 'list 1 2))
     30      (test '() (dict-update-list!-synch tbl1 'list))
     31      (test '(1 2) (dict-update-list!-synch tbl1 'list 1 2))
    3232
    33       (let ((tbl2 (dict-update-dict!/synch tbl1 'dict)))
    34         (test tbl2 (dict-ref/synch tbl1 'dict))
    35         (test tbl2 (dict-update-dict!/synch tbl1 'dict)) ) )
     33      (let ((tbl2 (dict-update-dict!-synch tbl1 'dict)))
     34        (test tbl2 (dict-ref-synch tbl1 'dict))
     35        (test tbl2 (dict-update-dict!-synch tbl1 'dict)) ) )
    3636
    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))
    39       (test (+ allen 1) (dict-count/synch tbl))
    40       (test foodat (dict-ref/synch tbl 'foo))
    41       (test 'pob (dict-ref/synch tbl 'baz))
    42       (test 'rab (dict-ref/synch tbl 'off)) ) )
     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))
     39      (test (+ allen 1) (dict-count-synch tbl))
     40      (test foodat (dict-ref-synch tbl 'foo))
     41      (test 'pob (dict-ref-synch tbl 'baz))
     42      (test 'rab (dict-ref-synch tbl 'off)) ) )
    4343)
    4444
     
    4747(define (dict-ht-test)
    4848        ; make sure not a hash-table rep initially
    49   (let ((tbl1 (make-dict/synch equal? 0)))
     49  (let ((tbl1 (make-dict-synch equal? 0)))
    5050
    5151    (do ([i 0 (add1 i)])
    5252        ([> i 54])
    5353      (if (odd? i)
    54           (dict-set!/synch tbl1 i (->string i))
    55           (dict-set!/synch tbl1 (->string i) i)))
     54          (dict-set!-synch tbl1 i (->string i))
     55          (dict-set!-synch tbl1 (->string i) i)))
    5656
    57     (test 20 (dict-ref/synch tbl1 "20"))
    58     (test-assert (begin (dict-delete!/synch tbl1 "20") #t))
    59     (test-assert (not (dict-ref/synch tbl1 "20")))
     57    (test 20 (dict-ref-synch tbl1 "20"))
     58    (test-assert (begin (dict-delete!-synch tbl1 "20") #t))
     59    (test-assert (not (dict-ref-synch tbl1 "20")))
    6060
    61     (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))
    6262
    63     (test 'bop (dict-ref/synch tbl1 'baz))
     63    (test 'bop (dict-ref-synch tbl1 'baz))
    6464
    65     (test 'bar (dict-search/synch tbl1 (lambda (key val) (eq? key 'foo))))
     65    (test 'bar (dict-search-synch tbl1 (lambda (key val) (eq? key 'foo))))
    6666
    67     (test-assert (with-output-to-string (lambda () (dict-print/synch tbl1)))) )
     67    (test-assert (with-output-to-string (lambda () (dict-print-synch tbl1)))) )
    6868)
    6969
  • release/4/lookup-table/trunk/tests/unsafe-synch.scm

    r34956 r35097  
    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))
    21       (test tst (dict-equivalence-function/%synch tbl1))
     20      (test-assert (dict?-synch tbl1))
     21      (test tst (dict-equivalence-function-%synch tbl1))
    2222
    23       (test-assert (tst foodat (dict-ref/%synch tbl1 'foo)))
    24       (test-assert (begin (dict-delete!/%synch tbl1 'foo) #t))
    25       (test-assert (not (dict-ref/%synch tbl1 'foo)))
     23      (test-assert (tst foodat (dict-ref-%synch tbl1 'foo)))
     24      (test-assert (begin (dict-delete!-%synch tbl1 'foo) #t))
     25      (test-assert (not (dict-ref-%synch tbl1 'foo)))
    2626
    27       (test '() (dict-update!/%synch tbl1 'foo (lambda () '())))
    28       (test '(1) (dict-update!/%synch tbl1 'foo void (lambda (x) (append x '(1)))))
     27      (test '() (dict-update!-%synch tbl1 'foo (lambda () '())))
     28      (test '(1) (dict-update!-%synch tbl1 'foo void (lambda (x) (append x '(1)))))
    2929
    30       (test '() (dict-update-list!/%synch tbl1 'list))
    31       (test '(1 2) (dict-update-list!/%synch tbl1 'list 1 2))
     30      (test '() (dict-update-list!-%synch tbl1 'list))
     31      (test '(1 2) (dict-update-list!-%synch tbl1 'list 1 2))
    3232
    33       (let ((tbl2 (dict-update-dict!/%synch tbl1 'dict)))
    34         (test tbl2 (dict-ref/%synch tbl1 'dict))
    35         (test tbl2 (dict-update-dict!/%synch tbl1 'dict)) ) )
     33      (let ((tbl2 (dict-update-dict!-%synch tbl1 'dict)))
     34        (test tbl2 (dict-ref-%synch tbl1 'dict))
     35        (test tbl2 (dict-update-dict!-%synch tbl1 'dict)) ) )
    3636
    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))
    39       (test (+ allen 1) (dict-count/%synch tbl))
    40       (test foodat (dict-ref/%synch tbl 'foo))
    41       (test 'pob (dict-ref/%synch tbl 'baz))
    42       (test 'rab (dict-ref/%synch tbl 'off)) ) )
     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))
     39      (test (+ allen 1) (dict-count-%synch tbl))
     40      (test foodat (dict-ref-%synch tbl 'foo))
     41      (test 'pob (dict-ref-%synch tbl 'baz))
     42      (test 'rab (dict-ref-%synch tbl 'off)) ) )
    4343)
    4444
     
    4747(define (dict-ht-test)
    4848        ; make sure not a hash-table rep initially
    49   (let ((tbl1 (make-dict/synch equal? 0)))
     49  (let ((tbl1 (make-dict-synch equal? 0)))
    5050
    5151    (do ([i 0 (add1 i)])
    5252        ([> i 54])
    5353      (if (odd? i)
    54           (dict-set!/%synch tbl1 i (->string i))
    55           (dict-set!/%synch tbl1 (->string i) i)))
     54          (dict-set!-%synch tbl1 i (->string i))
     55          (dict-set!-%synch tbl1 (->string i) i)))
    5656
    57     (test 20 (dict-ref/%synch tbl1 "20"))
    58     (test-assert (begin (dict-delete!/%synch tbl1 "20") #t))
    59     (test-assert (not (dict-ref/%synch tbl1 "20")))
     57    (test 20 (dict-ref-%synch tbl1 "20"))
     58    (test-assert (begin (dict-delete!-%synch tbl1 "20") #t))
     59    (test-assert (not (dict-ref-%synch tbl1 "20")))
    6060
    61     (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))
    6262
    63     (test 'bop (dict-ref/%synch tbl1 'baz))
     63    (test 'bop (dict-ref-%synch tbl1 'baz))
    6464
    65     (test 'bar (dict-search/%synch tbl1 (lambda (key val) (eq? key 'foo))))
     65    (test 'bar (dict-search-%synch tbl1 (lambda (key val) (eq? key 'foo))))
    6666
    67     (test-assert (with-output-to-string (lambda () (dict-print/%synch tbl1)))) )
     67    (test-assert (with-output-to-string (lambda () (dict-print-%synch tbl1)))) )
    6868)
    6969
Note: See TracChangeset for help on using the changeset viewer.