Changeset 36064 in project


Ignore:
Timestamp:
08/08/18 20:42:09 (14 months ago)
Author:
Kon Lovett
Message:

win supp mm

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

Legend:

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

    r35984 r36064  
    44
    55;;Issues
     6;;
     7;; - Use "chunk-size".
    68;;
    79;; - Uses 'context-info' to determine whether active context is "own" allocation or
     
    9698          (chunk (make-message-digest-raw-chunk buffer siz 0)) )
    9799          (lambda ()
     100            ;returns ptr to file-chunk until #floor
     101            ;memory-map means only 1 file-chunk
    98102            (if buffer
    99103              (begin
    100104                (set! buffer #f)
    101                 chunk)
     105                chunk )
    102106              (begin
    103107                (cleanup)
    104108                #f ) ) ) ) ) ) ) )
    105109
     110(cond-expand
     111
     112  ((or windows unix)
     113
     114    (import
     115      (only memory-mapped-files
     116        map-file-to-memory unmap-file-from-memory
     117        memory-mapped-file-pointer map/shared prot/read))
     118
     119    (: mapped-buffer (symbol fixnum fixnum -> pointer procedure))
     120    ;
     121    (define (mapped-buffer loc fd siz)
     122      (let* (
     123        (mmap (map-file-to-memory #f siz prot/read map/shared fd))
     124        (ptr (memory-mapped-file-pointer mmap))
     125        (finalize (cut unmap-file-from-memory mmap)) )
     126        (values ptr finalize) ) ) )
     127
     128  (else
     129
     130    ;tested w/ macosx (replaced mmap version)
     131
     132    (import (only (chicken memory) allocate free))
     133
     134    (: read-into-buffer (fixnum pointer fixnum -> boolean))
     135    ;
     136    (define read-into-buffer
     137      (foreign-lambda* bool ((int fd) (c-pointer buffer) (integer size))
     138        "C_return( read( fd, buffer, size ) == size );") )
     139
     140    (: mapped-buffer (symbol fixnum fixnum -> pointer procedure))
     141    ;
     142    (define (mapped-buffer loc fd siz)
     143      (let* (
     144        (ptr (allocate siz))
     145        (finalize (cut free ptr)) )
     146        (unless (read-into-buffer fd ptr siz)
     147          (finalize)
     148          (error loc "cannot read file") )
     149        (values ptr finalize) ) ) ) )
     150
     151#; ;
    106152(cond-expand
    107153
     
    136182        memory-mapped-file-pointer map/shared prot/read))
    137183
    138       (: mapped-buffer (symbol fixnum fixnum -> pointer procedure))
    139       ;
    140       (define (mapped-buffer loc fd siz)
    141         (let* (
    142           (mmap (map-file-to-memory #f siz prot/read map/shared fd))
    143           (ptr (memory-mapped-file-pointer mmap))
    144           (finalize (cut unmap-file-from-memory mmap)) )
    145           (values ptr finalize) ) ) ) )
     184    (: mapped-buffer (symbol fixnum fixnum -> pointer procedure))
     185    ;
     186    (define (mapped-buffer loc fd siz)
     187      (let* (
     188        (mmap (map-file-to-memory #f siz prot/read map/shared fd))
     189        (ptr (memory-mapped-file-pointer mmap))
     190        (finalize (cut unmap-file-from-memory mmap)) )
     191        (values ptr finalize) ) ) ) )
    146192
    147193;;
  • release/5/message-digest-utils/trunk/message-digest-utils.egg

    r35953 r36064  
    33
    44((synopsis "Message Digest Support")
    5  (version "4.0.0")
     5 (version "4.1.0")
    66 (category crypt)
    77 (author "[[kon lovett]]")
     
    1111        (blob-utils "2.0.0")
    1212        (string-utils "2.0.5")
    13         (memory-mapped-files "0.1")
     13        (memory-mapped-files "0.2")
    1414        (message-digest-primitive "4.1.0")
    1515        (message-digest-type "4.0.1"))
Note: See TracChangeset for help on using the changeset viewer.