Changeset 12011 in project


Ignore:
Timestamp:
09/26/08 20:50:45 (12 years ago)
Author:
Kon Lovett
Message:

Use of "unsafe" record-type. Removed 'make-dict' old arg order support.

Location:
release/3/lookup-table
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/3/lookup-table/tags/1.7.0/lookup-table-eggdoc.scm

    r9829 r12011  
    137137
    138138                (history
     139                        (version "1.7.0" "Removed backward compatibility for 'make-dict' argument order.")
    139140                        (version "1.6.0" "Replaced dict-unsafe-mode with dict-safe-mode. The update operations now rebind storage model.")
    140141                        (version "1.502" "Added 'dict-keys', 'dict-values'")
  • release/3/lookup-table/tags/1.7.0/lookup-table.html

    r9829 r12011  
    235235<h3>Version</h3>
    236236<ul>
     237<li>1.7.0 Removed backward compatibility for 'make-dict' argument order.</li>
    237238<li>1.6.0 Replaced dict-unsafe-mode with dict-safe-mode. The update operations now rebind storage model.</li>
    238239<li>1.502 Added 'dict-keys', 'dict-values'</li>
  • release/3/lookup-table/tags/1.7.0/lookup-table.scm

    r9829 r12011  
    5151;;; Variant Dictionary
    5252
    53 (define-unchecked-record-type dict
     53(define-record-type/unsafe-inline-unchecked dict
    5454        (%make-dict data)
    5555        %dict?
     
    367367
    368368(define (make-dict #!optional (test eq?) (size 0))
    369   ; Backwards compatibility
    370         (when (procedure? size)
    371                 (unless (fixnum? test)
    372                         (set! test 0))
    373                 (swap-set! size test))
    374         (when (fixnum? test)
    375                 (unless (procedure? size)
    376                         (set! size eq?))
    377                 (swap-set! size test))
    378   ;
    379369  (when *dict-safe-mode*
    380370    (check-size size 'make-dict)
     
    397387        (%dict->alist dict) )
    398388
    399 (define (dict? obj)
    400         (%dict? obj) )
     389(define dict? %dict?)
    401390
    402391(define (dict-equivalence-function dict)
  • release/3/lookup-table/tags/1.7.0/lookup-table.setup

    r9829 r12011  
    22
    33(required-extension-version
    4   'misc-extn              "3.0"
     4  'misc-extn              "3.2.0"
    55  'miscmacros             "2.4")
    66
  • release/3/lookup-table/tags/1.7.0/tests/lookup-table-test.scm

    r9829 r12011  
    55
    66;;;
    7 
    8 ;;
    9 
    10 ;Check backward compatible argument order for 'make-dict'
    11 (define-test (dict-size-test siz) "Dict Sized Make Test"
    12   (initial
    13     (define tbl1)
    14     (define tbl2) )
    15 
    16   (expect-false (dict? 'foo))
    17 
    18   (expect-set! tbl1 (make-dict siz))
    19   (expect-true (dict? tbl1))
    20 
    21   (expect-success (dict-set! tbl1 'foo 'bar))
    22   (expect-success (dict-set! tbl1 'bar 'foo))
    23   (expect-success (dict-set! tbl1 're 'bar))
    24 
    25   (expect-eq 'bar (dict-ref tbl1 'foo))
    26   (expect-success (dict-delete! tbl1 'foo))
    27   (expect-false (dict-ref tbl1 'foo))
    28 
    29   (expect-eq '() (dict-update! tbl1 'foo (lambda () '())))
    30   (expect-equal '(1) (dict-update! tbl1 'foo void (lambda (x) (append x '(1)))))
    31 
    32   (expect-eq '() (dict-update-list! tbl1 'list))
    33   (expect-equal '(1 2) (dict-update-list! tbl1 'list 1 2))
    34 
    35   (expect-set! tbl2 (dict-update-dict! tbl1 'dict))
    36   (expect-true (dict? (dict-ref tbl1 'dict)))
    37   (expect-eq tbl2 (dict-ref tbl1 'dict))
    38   (expect-eq tbl2 (dict-update-dict! tbl1 'dict))
    39 
    40   (expect-false (dict-exists? tbl1 're-bar))
    41   (expect-true (dict-exists? tbl1 're))
    42   (expect-true (dict-exists? tbl1 'bar))
    43 )
    44 
    45 (declare-test dict-size-test "Size 3" 3)
    46 (declare-test dict-size-test "Size 23" 23)
    477
    488;;
  • release/3/lookup-table/trunk/lookup-table-eggdoc.scm

    r9829 r12011  
    137137
    138138                (history
     139                        (version "1.7.0" "Removed backward compatibility for 'make-dict' argument order.")
    139140                        (version "1.6.0" "Replaced dict-unsafe-mode with dict-safe-mode. The update operations now rebind storage model.")
    140141                        (version "1.502" "Added 'dict-keys', 'dict-values'")
  • release/3/lookup-table/trunk/lookup-table.html

    r9829 r12011  
    235235<h3>Version</h3>
    236236<ul>
     237<li>1.7.0 Removed backward compatibility for 'make-dict' argument order.</li>
    237238<li>1.6.0 Replaced dict-unsafe-mode with dict-safe-mode. The update operations now rebind storage model.</li>
    238239<li>1.502 Added 'dict-keys', 'dict-values'</li>
  • release/3/lookup-table/trunk/lookup-table.scm

    r9829 r12011  
    5151;;; Variant Dictionary
    5252
    53 (define-unchecked-record-type dict
     53(define-record-type/unsafe-inline-unchecked dict
    5454        (%make-dict data)
    5555        %dict?
     
    367367
    368368(define (make-dict #!optional (test eq?) (size 0))
    369   ; Backwards compatibility
    370         (when (procedure? size)
    371                 (unless (fixnum? test)
    372                         (set! test 0))
    373                 (swap-set! size test))
    374         (when (fixnum? test)
    375                 (unless (procedure? size)
    376                         (set! size eq?))
    377                 (swap-set! size test))
    378   ;
    379369  (when *dict-safe-mode*
    380370    (check-size size 'make-dict)
     
    397387        (%dict->alist dict) )
    398388
    399 (define (dict? obj)
    400         (%dict? obj) )
     389(define dict? %dict?)
    401390
    402391(define (dict-equivalence-function dict)
  • release/3/lookup-table/trunk/lookup-table.setup

    r9829 r12011  
    22
    33(required-extension-version
    4   'misc-extn              "3.0"
     4  'misc-extn              "3.2.0"
    55  'miscmacros             "2.4")
    66
  • release/3/lookup-table/trunk/tests/lookup-table-test.scm

    r9829 r12011  
    55
    66;;;
    7 
    8 ;;
    9 
    10 ;Check backward compatible argument order for 'make-dict'
    11 (define-test (dict-size-test siz) "Dict Sized Make Test"
    12   (initial
    13     (define tbl1)
    14     (define tbl2) )
    15 
    16   (expect-false (dict? 'foo))
    17 
    18   (expect-set! tbl1 (make-dict siz))
    19   (expect-true (dict? tbl1))
    20 
    21   (expect-success (dict-set! tbl1 'foo 'bar))
    22   (expect-success (dict-set! tbl1 'bar 'foo))
    23   (expect-success (dict-set! tbl1 're 'bar))
    24 
    25   (expect-eq 'bar (dict-ref tbl1 'foo))
    26   (expect-success (dict-delete! tbl1 'foo))
    27   (expect-false (dict-ref tbl1 'foo))
    28 
    29   (expect-eq '() (dict-update! tbl1 'foo (lambda () '())))
    30   (expect-equal '(1) (dict-update! tbl1 'foo void (lambda (x) (append x '(1)))))
    31 
    32   (expect-eq '() (dict-update-list! tbl1 'list))
    33   (expect-equal '(1 2) (dict-update-list! tbl1 'list 1 2))
    34 
    35   (expect-set! tbl2 (dict-update-dict! tbl1 'dict))
    36   (expect-true (dict? (dict-ref tbl1 'dict)))
    37   (expect-eq tbl2 (dict-ref tbl1 'dict))
    38   (expect-eq tbl2 (dict-update-dict! tbl1 'dict))
    39 
    40   (expect-false (dict-exists? tbl1 're-bar))
    41   (expect-true (dict-exists? tbl1 're))
    42   (expect-true (dict-exists? tbl1 'bar))
    43 )
    44 
    45 (declare-test dict-size-test "Size 3" 3)
    46 (declare-test dict-size-test "Size 23" 23)
    477
    488;;
Note: See TracChangeset for help on using the changeset viewer.