| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.2.2 mmap
The mmap function asks to map a file into memory. This memory area
can be randomly accessed as a string. In general using mmap improves
performance in comparison with equivalent code using regular ports.
- bigloo procedure: mmap? obj
Returns
#tif and only if obj has been produced byopen-mmap. Otherwise, it returns#f.
- bigloo procedure: open-mmap path [mode]
Maps a file path into memory. The optional argument mode specifies how the file is open. The argument can be:
-
read: #tThe memory can be read -
read: #fThe memory cannot be read -
write: #tThe memory can be written -
write: #fThe memory is read-only.
-
- bigloo procedure: mmap-read-position mm
- bigloo procedure: mmap-read-position-set! mm offset
- bigloo procedure: mmap-write-position mm
- bigloo procedure: mmap-write-position-set! mm offset
Returns and sets the read and write position of a memory mapped memory. The result and the argument are exact integers.
- bigloo procedure: mmap-ref mm offset
Reads the character in mm at offset, an exact long (::elong). This function sets the read position to
offset + 1.
- bigloo procedure: mmap-set! mm offset char
Writes the character char in mm at offset, an exact long (::elong). This function sets the write position to
offset + 1.
- bigloo procedure: mmap-substring mm start end
Returns a newly allocated string made of the characters read from mm starting at position start and ending at position end - 1. If the values
startandendare not ranged in[0...(mmap-length mm)], an error is signaled. The functionmmap-substringsets the read position toend.
- bigloo procedure: mmap-substring-set! mm start str
Writes the string str to mm at position start. If the values
startandstart + (string-length str)are not ranged in[0...(mmap-length mm)[, an error is signaled. The functionmmap-substringsets the write position tostart + (string-length str).
- bigloo procedure: mmap-get-char mm
- bigloo procedure: mmap-put-char! mm c
- bigloo procedure: mmap-get-string mm len
- bigloo procedure: mmap-put-string! mm str
These functions get (resp. put) character and strings into a memory mapped area. They increment the read (resp. write) position. An error is signaled if the characters read (resp. writen) outbound the length of the memory mapped.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on October 23, 2011 using texi2html 5.0.
