Changeset 35921 in project


Ignore:
Timestamp:
07/15/18 22:35:08 (14 months ago)
Author:
Kon Lovett
Message:

use untyped #!rest, fix item optns, add deps, fix test

Location:
release/5/message-digest-utils/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • release/5/message-digest-utils/trunk/message-digest-chunk.scm

    r35914 r35921  
    5151;;; Update Phase Helpers
    5252
    53 (: default-chunk-port-read-maker (input-port #!rest (list fixnum) -> procedure))
     53(: default-chunk-port-read-maker (input-port #!rest -> procedure))
    5454;
    5555(define (default-chunk-port-read-maker port . opts)
     
    8484  (beg message-digest-raw-chunk-start) )
    8585
    86 (: default-chunk-fileno-read-maker (fixnum #!rest (list fixnum) -> procedure))
     86(: default-chunk-fileno-read-maker (fixnum #!rest -> procedure))
    8787;
    8888(define (default-chunk-fileno-read-maker fd . opts)
  • release/5/message-digest-utils/trunk/message-digest-int.scm

    r35914 r35921  
    131131;; Machine Byte Order w/ Char & Unsigned Integer
    132132
    133 (: message-digest-update-char (message-digest char #!rest (list message-digest-byte-order) -> void))
     133(: message-digest-update-char (message-digest char #!rest -> void))
    134134;
    135135(define (message-digest-update-char md ch . opts)
     
    140140      ((big-endian)                     (message-digest-update-char-be md ch) ) ) ) )
    141141
    142 (: message-digest-update-u16 (message-digest number #!rest (list message-digest-byte-order) -> void))
     142(: message-digest-update-u16 (message-digest number #!rest -> void))
    143143;
    144144(define (message-digest-update-u16 md n . opts)
     
    149149      ((big-endian)                     (message-digest-update-u16-be md n) ) ) ) )
    150150
    151 (: message-digest-update-u32 (message-digest number #!rest (list message-digest-byte-order) -> void))
     151(: message-digest-update-u32 (message-digest number #!rest -> void))
    152152;
    153153(define (message-digest-update-u32 md n . opts)
     
    158158      ((big-endian)                     (message-digest-update-u32-be md n) ) ) ) )
    159159
    160 (: message-digest-update-u64 (message-digest number #!rest (list message-digest-byte-order) -> void))
     160(: message-digest-update-u64 (message-digest number #!rest -> void))
    161161;
    162162(define (message-digest-update-u64 md n . opts)
  • release/5/message-digest-utils/trunk/message-digest-item.scm

    r35914 r35921  
    3434;;
    3535
    36 (: message-digest-object (message-digest-primitive * #!rest list -> message-digest-result-type))
     36(: message-digest-object (message-digest-primitive * #!rest -> message-digest-result-type))
    3737;
    3838(define (message-digest-object mdp obj . opts)
     
    4545      (finalize-message-digest md restyp) ) ) )
    4646
    47 (: message-digest-file (message-digest-primitive pathname #!rest list -> message-digest-result-type))
     47(: message-digest-file (message-digest-primitive pathname #!rest -> message-digest-result-type))
    4848;
    4949(define (message-digest-file mdp flnm . opts)
    50   (let (
    51     (restyp (message-digest-result-form))
    52     (md (initialize-message-digest mdp)) )
    53     (message-digest-update-file md flnm)
    54     (finalize-message-digest md restyp) ) )
     50  (let-optionals* opts (
     51    (restyp (message-digest-result-form)) )
     52    (let (
     53      (md (initialize-message-digest mdp)) )
     54      (message-digest-update-file md flnm)
     55      (finalize-message-digest md restyp) ) ) )
    5556
    56 (: message-digest-port (message-digest-primitive output-port #!rest list -> message-digest-result-type))
     57(: message-digest-port (message-digest-primitive output-port #!rest -> message-digest-result-type))
    5758;
    5859(define (message-digest-port mdp port . opts)
    59   (let (
    60     (restyp (message-digest-result-form))
    61     (md (initialize-message-digest mdp)) )
    62     (message-digest-update-port md port)
    63     (finalize-message-digest md restyp) ) )
     60  (let-optionals* opts (
     61    (restyp (message-digest-result-form)) )
     62    (let (
     63      (md (initialize-message-digest mdp)) )
     64      (message-digest-update-port md port)
     65      (finalize-message-digest md restyp) ) ) )
    6466
    6567;;
    6668
    67 (: message-digest-object! (message-digest-primitive * message-digest-buffer #!rest list -> message-digest-result-type))
     69(: message-digest-object! (message-digest-primitive * message-digest-buffer #!rest -> message-digest-result-type))
    6870;
    6971(define (message-digest-object! mdp obj buf . opts)
  • release/5/message-digest-utils/trunk/message-digest-port.scm

    r35914 r35921  
    166166        (close-output-port port))) ) )
    167167
    168 (: get-output-digest (digest-output-port #!rest (list message-digest-result-type) -> message-digest-result-type))
     168(: get-output-digest (digest-output-port #!rest -> message-digest-result-type))
    169169;
    170170(define (get-output-digest port . opts)
     
    175175;;;
    176176
    177 (: call-with-output-digest (message-digest-primitive procedure #!rest (list message-digest-result-type) -> message-digest-result-type))
     177(: call-with-output-digest (message-digest-primitive procedure #!rest -> message-digest-result-type))
    178178;
    179179(define (call-with-output-digest mdp proc . opts)
     
    187187        (lambda () (*close-output-digest 'call-with-output-digest port restyp))) ) ) )
    188188
    189 (: with-output-to-digest (message-digest-primitive procedure #!rest (list message-digest-result-type) -> message-digest-result-type))
     189(: with-output-to-digest (message-digest-primitive procedure #!rest -> message-digest-result-type))
    190190;
    191191(define (with-output-to-digest mdp thunk . opts)
  • release/5/message-digest-utils/trunk/message-digest-srfi-4.scm

    r35914 r35921  
    5353;;
    5454
    55 (: message-digest-update-u8vector (message-digest u8vector #!rest list -> void))
     55(: message-digest-update-u8vector (message-digest u8vector #!rest -> void))
    5656;
    5757(define (message-digest-update-u8vector md u8vec . opts)
     
    6464;;; Single Source API
    6565
    66 (: message-digest-u8vector (message-digest-primitive u8vector #!rest list -> message-digest-result-type))
     66(: message-digest-u8vector (message-digest-primitive u8vector #!rest -> message-digest-result-type))
    6767;
    6868(define (message-digest-u8vector mdp u8vec . opts)
     
    7575      (finalize-message-digest md restyp) ) ) )
    7676
    77 (: message-digest-u8vector! (message-digest-primitive u8vector message-digest-buffer #!rest list -> message-digest-result-type))
     77(: message-digest-u8vector! (message-digest-primitive u8vector message-digest-buffer #!rest -> message-digest-result-type))
    7878;
    7979(define (message-digest-u8vector! mdp u8vec buffer . opts)
  • release/5/message-digest-utils/trunk/message-digest-support.scm

    r35914 r35921  
    117117;;
    118118
    119 (: *message-digest-update-blob (message-digest blob #!rest (list fixnum) -> void))
     119(: *message-digest-update-blob (message-digest blob #!rest -> void))
    120120;
    121121(define (*message-digest-update-blob md blb . opts)
  • release/5/message-digest-utils/trunk/message-digest-update-item.scm

    r35914 r35921  
    101101      (and-let* ((dat (proc)))
    102102        (do-byte-source-update loc ctx dat src-updt raw-updt start end)
    103         (loop) ) ) ) )
     103        (loop) ) )
     104    ;do not return #f
     105    (void) ) )
    104106
    105107(: do-bytes-update (symbol message-digest * start-index end-index -> void))
     
    154156;;
    155157
    156 (: message-digest-update-object (message-digest * #!rest list -> void))
     158(: message-digest-update-object (message-digest * #!rest -> void))
    157159;
    158160(define (message-digest-update-object md obj . opts)
  • release/5/message-digest-utils/trunk/message-digest-utils.egg

    r35914 r35921  
    1111        (blob-utils "2.0.0")
    1212        (string-utils "2.0.5")
    13         (memory-mapped-files "0.1"))
     13        (memory-mapped-files "0.1")
     14        (message-digest-primitive "4.1.0")
     15        (message-digest-type "4.0.1"))
    1416 (test-dependencies test)
    1517 (components
  • release/5/message-digest-utils/trunk/tests/message-digest-utils-test.scm

    r35914 r35921  
    1414(import
    1515  (chicken base)
     16  ;(chicken format)
    1617  (chicken fixnum)
    1718  (chicken blob)
     19  (chicken memory)
     20  (srfi 4)
    1821  message-digest-primitive
    1922  message-digest-type
    20   message-digest-chunk message-digest-port)
     23  message-digest-chunk
     24  message-digest-port
     25  message-digest-srfi-4
     26  message-digest-int
     27  message-digest-update-item
     28  message-digest-item)
    2129
    2230;;
     
    8290
    8391  (define (update ctx bytes count)
    84     (printf "Update Ctx: ~S Bytes: ~S Count: ~S~%" ctx bytes count) (flush-output)
     92    ;(printf "Update Ctx: ~S Bytes: ~S Count: ~S~%" ctx bytes count) (flush-output)
    8593    (assert (eq? ctx the-ctx))
    8694    (assert (not (not bytes)))
     
    9199
    92100  (define (final ctx result)
    93     (printf "Final Result Size: ~S Ctx: ~S Result: ~S~%" (blob-size result) ctx result) (flush-output)
     101    ;(printf "Final Result Size: ~S Ctx: ~S Result: ~S~%" (blob-size result) ctx result) (flush-output)
    94102    (assert (eq? ctx the-ctx))
    95103    (assert (not (not result)))
     
    182190)
    183191
    184 #; ;REMOVED
    185 (begin
    186         (use message-digest-old)
    187 
    188         (define the-ctx #f)
    189 
    190   (define (make-context)
    191     (string->blob (make-string CONTEXT-SIZE #\nul)) )
    192 
    193   (define (init ctx)
    194     (set! the-ctx ctx) )
    195 
    196   (define (update ctx bytes count)
    197     (assert (eq? ctx the-ctx))
    198     (assert (not (not bytes)))
    199     (assert (< 0 count))
    200     (assert (<= count CONTEXT-SIZE))  ; So no mem overflow
    201     (assert (blob? ctx))
    202     (move-memory! bytes ctx count) )
    203 
    204   (define (final ctx result)
    205     (assert (eq? ctx the-ctx))
    206     (assert (not (not result)))
    207     (assert (blob? ctx))
    208     (assert (<= (blob-size result)  DIGEST-LENGTH))  ; So no mem overflow
    209     (move-memory! ctx result DIGEST-LENGTH) )
    210 
    211   (test-group "Primitive Apply (DEPRECATED)"
    212     (let* (
    213       (mdp
    214         (make-message-digest-primitive CONTEXT-SIZE DIGEST-LENGTH init update final))
    215       (res (message-digest-primitive-apply mdp simple-src)) )
    216       (test-assert (string? res))
    217       (test simple-res (byte-string->hexadecimal res)) )
    218   )
    219 
    220   (test-group "Make (DEPRECATED)"
    221     (test simple-src (make-binary-message-digest simple-src make-context DIGEST-LENGTH init update final))
    222     (test simple-res (make-message-digest simple-src make-context DIGEST-LENGTH init update final))
    223   )
    224 )
    225 
    226192;
    227193(test-group "Chunk Read (fileno)"
     
    262228  (let (
    263229    (mdp
    264       (make-message-digest-primitive CONTEXT-SIZE DIGEST-LENGTH init update final raw-update)) )
     230      (make-message-digest-primitive CONTEXT-SIZE DIGEST-LENGTH init update final #:raw-update raw-update)) )
    265231    (test "6162636465" (message-digest-file mdp SHORT-TEST-FILE-NAME 'hex-string)) )
    266232)
Note: See TracChangeset for help on using the changeset viewer.