Changeset 12070 in project


Ignore:
Timestamp:
10/01/08 06:17:43 (12 years ago)
Author:
Ivan Raikov
Message:

Switched to using matchable.

Location:
release/3/digraph/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/3/digraph/trunk/digraph-eggdoc.scm

    r11122 r12070  
    99
    1010     (history
     11      (version "1.10" "Now using matchable extension")
    1112      (version "1.9" "Added procedures pred-list and succ-list")
    1213      (version "1.8" "Added procedure node-info-set!")
     
    2021      (version "1.0" "Initial release"))
    2122
    22      (requires (url "dyn-vector.html" "dyn-vector"))
     23     (requires (url "dyn-vector.html" "dyn-vector")
     24               (url "syntax-case.html" "syntax-case")
     25               (url "matchable.html" "matchable"))
    2326
    2427     (usage "(require-extension digraph)")
  • release/3/digraph/trunk/digraph.meta

    r9198 r12070  
    1616 ; A list of eggs digraph depends on.
    1717
    18  (needs testbase eggdoc dyn-vector)
     18 (needs testbase eggdoc dyn-vector syntax-case matchable)
    1919
    2020 (eggdoc "digraph-eggdoc.scm")
  • release/3/digraph/trunk/digraph.scm

    r11122 r12070  
    2525(require-extension srfi-1)
    2626(require-extension dyn-vector)
     27(require-extension syntax-case)
     28(require-extension matchable)
    2729
    2830(define-extension digraph)
     
    6769
    6870  (define (get-nodes)
    69     (dynvector-fold
    70      (lambda (i st v) (case v ((none) st) (else (cons (list i v) st))))
     71    (dynvector-fold (lambda (i st v) (if (eq? 'none v)  st  (cons (list i v) st)))
    7172     (list) nodes))
    7273
     
    8485
    8586  (define (add-node! i info)
    86     (case (dynvector-ref nodes i)
    87       ((none) (set! node-count (fx+ 1 node-count))))
     87    (if (eq? 'none (dynvector-ref nodes i))
     88        (set! node-count (fx+ 1 node-count)))
    8889    (dynvector-set! nodes i info))
    8990
     
    152153
    153154  (define (remove-node! i)
    154     (case (dynvector-ref nodes i)
    155       ((none))
    156       (else    (begin
    157                  (set-out-edges! i (list))
    158                  (set-in-edges! i  (list))
    159                  (dynvector-set! nodes i 'none)
    160                  (set! node-count (fx- node-count 1))
    161                  (set! garbage-nodes (cons i garbage-nodes))
    162                  (void)))))
     155    (if (not (eq? 'none (dynvector-ref nodes i)))
     156        (begin
     157          (set-out-edges! i (list))
     158          (set-in-edges! i  (list))
     159          (dynvector-set! nodes i 'none)
     160          (set! node-count (fx- node-count 1))
     161          (set! garbage-nodes (cons i garbage-nodes))
     162          (void))))
    163163 
    164164  (define (remove-nodes! ns) (for-each remove-node! ns))
     
    178178                                  (dynvector-ref succ i)))
    179179 
    180   (define (has-node n)       (case (dynvector-ref nodes n)
    181                                ((none)  #f)
    182                                (else #t)))
     180  (define (has-node n)       (not (eq? 'none (dynvector-ref nodes n))))
    183181
    184182  (define (node-info n)      (let ((info (dynvector-ref nodes n)))
    185                                (case info
    186                                  ((none)  #f)
    187                                  (else    info))))
     183                               (and (not (eq? 'none info)) info)))
    188184
    189185  (define (node-info-set! n v)   (dynvector-set! nodes n v))
    190186
    191187
    192   (define (foreach-node f)   (dynvector-for-each (lambda (i x) (case x  ((none)) (else  (f i x)))) nodes))
     188  (define (foreach-node f)   (dynvector-for-each (lambda (i x) (if (not (eq? 'none x))  (f i x)))
     189                                                 nodes))
     190
    193191  (define (foreach-edge f)   (dynvector-for-each f succ))
    194192
  • release/3/digraph/trunk/digraph.setup

    r11122 r12070  
    2121
    2222  ; Assoc list with properties for your extension:
    23   `((version 1.9)
     23  `((version 1.10)
    2424    (documentation "digraph.html")
    2525    ,@(if has-exports? `((exports "digraph.exports")) (list)) ))
Note: See TracChangeset for help on using the changeset viewer.