Changeset 35088 in project


Ignore:
Timestamp:
01/28/18 16:27:06 (4 months ago)
Author:
kon
Message:

more typing , bucket ako pair ?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/apropos/trunk/apropos.scm

    r35056 r35088  
    9191;;; Support
    9292
     93(define (->boolean obj)
     94  (and
     95    obj
     96    #t ) )
     97
    9398;; irregex extensions
    9499
     
    215220<#
    216221
     222(: root-symbol-table-size (--> fixnum))
    217223(define root-symbol-table-size
    218224  (foreign-lambda* int ()
    219225    "C_return( raw_symbol_table_size( use_root_symbol_table() ) );") )
    220226
     227(: root-symbol-table-element (fixnum --> pair))
    221228(define root-symbol-table-element
    222229  (foreign-lambda* scheme-object ((int i))
    223230    "C_return( raw_symbol_table_chain( use_root_symbol_table(), i ) );") )
    224231
     232(: bucket-symbol (pair --> symbol))
    225233(define bucket-symbol
    226234  (foreign-lambda* scheme-object ((scheme-object bucket))
    227235    "C_return( raw_bucket_symbol( bucket ) );"))
    228236
     237(: bucket-link (pair --> list))
    229238(define bucket-link
    230239  (foreign-lambda* scheme-object ((scheme-object bucket))
    231240    "C_return( raw_bucket_link( bucket ) );"))
    232241
     242(: bucket-last? (list --> boolean))
    233243(define bucket-last? null?)
    234244
     
    237247(define-type <symbol-table-cursor> (or boolean pair))
    238248
     249(: make-symbol-table-cursor (* * --> <symbol-table-cursor>))
    239250(define make-symbol-table-cursor cons)
    240251
     252(: symbol-table-cursor-active? (* --> boolean))
    241253(define symbol-table-cursor-active? pair?)
    242254
     255(: symbol-table-cursor? (* --> boolean))
    243256(define (symbol-table-cursor? obj)
    244257  (or
     
    246259    (symbol-table-cursor-active? obj)) )
    247260
     261(: symbol-table-cursor-index (<symbol-table-cursor> --> *))
    248262(define symbol-table-cursor-index car)
     263
     264(: set-symbol-table-cursor-index! (<symbol-table-cursor> * -> void))
    249265(define set-symbol-table-cursor-index! set-car!)
    250266
     267(: symbol-table-cursor-bucket (<symbol-table-cursor> --> *))
    251268(define symbol-table-cursor-bucket cdr)
     269
     270(: set-symbol-table-cursor-bucket! (<symbol-table-cursor> * -> void))
    252271(define set-symbol-table-cursor-bucket! set-cdr!)
    253272
     
    295314    (symbol-table-cursor-active? cursor)
    296315    (let loop (
    297         (bkt (bucket-link? (symbol-table-cursor-bucket cursor)))
    298         (idx (symbol-table-cursor-index cursor)))
     316      (bkt (bucket-link-ref (symbol-table-cursor-bucket cursor)))
     317      (idx (symbol-table-cursor-index cursor)))
    299318      ;gotta bucket ?
    300319      (if (and bkt (not (bucket-last? bkt)))
     
    317336  (and
    318337    (symbol-table-cursor-active? cursor)
    319     (bucket-symbol? (symbol-table-cursor-bucket cursor)) ) )
    320 
    321 (define (bucket-symbol? bkt)
    322   (and (not (bucket-last? bkt)) (bucket-symbol bkt)) )
    323 
    324 (define (bucket-link? bkt)
    325   (and (not (bucket-last? bkt)) (bucket-link bkt)) )
     338    (bucket-symbol-ref (symbol-table-cursor-bucket cursor)) ) )
     339
     340(: bucket-symbol-ref (list --> (or boolean symbol)))
     341(define (bucket-symbol-ref bkt)
     342  (and
     343    (not (bucket-last? bkt))
     344    (bucket-symbol bkt) ) )
     345
     346(: bucket-link-ref (list --> (or boolean list)))
     347(define (bucket-link-ref bkt)
     348  (and
     349    (not (bucket-last? bkt))
     350    (bucket-link bkt)) )
    326351
    327352;;
Note: See TracChangeset for help on using the changeset viewer.