I have the following file:

<++> mmap.scm
(use posix)
(use lolevel)

(let* ((fd (file-open "mmap.scm" (+ open/rdonly open/nonblock)))
       (size (file-size fd))
       (mmap (map-file-to-memory #f size prot/read (+ map/file map/shared) fd))
       (buf  (memory-mapped-file-pointer mmap)))
  (write fd)
  (newline)
  (write size)
  (newline)
  (write mmap)
  (newline)
  (write buf)
  (newline)
  (write (pointer-s8-ref buf))
  (newline)
  (write (integer->char (pointer-s8-ref buf)))
  (newline))
<-->

Which opens itself as an mmap and reads the first byte.  The output
is:

<++> csc -o mmap mmap.scm && ./mmap
3
458
#<mmap>
#<pointer 0x8818c000>
40
#\(
<-->

So far so good, that is what I would expect.  I'd like to work with
an mmap buffer like a string.  Is it possible to create an object
that will treat the mmap area as a string that I can run regular
string operations on without copying the mmap buffer?  I'm
specifically interested in running regular expressions across the
mmap space.

-Alan
-- 
.i ko djuno fi le do sevzi

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to