Outdated egg!
This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
buffer-ports
TOC »
Introduction
This extensions allows creating input- and output ports over arbitrary memory buffers like strings, blobs and SRFI-4 number vectors, both in normal garbage collected and memory and in the permanent (static) heap. Ports can also be created on foreign pointer objects, locatives and memory mapped files.
open-input-buffer
- open-input-buffer THING #!optional LENGTH STARTprocedure
Creates and returns an input port. THING may be a string, blob, SRFI-4 number vector, foreign pointer, memory mapped file or locative. Reading from the port will read the contents of the data area designated by THING. The option LENGTH and START arguments can be used to limit the length of the data and the starting position.
If THING is a pointer, locative or memory mapped file, then LENGTH must be specified and will not be checked for being valid.
open-output-buffer
- open-output-buffer THING #!optional LENGTH STARTprocedure
Returns an output-port over the object THING. Otherwise similar to open-input-buffer.
open-memory-mapped-input-file
- open-memory-mapped-input-file FILENAMEprocedure
A convenience function for opening a file in a memory-mapped buffer. On Windows, this procedure is equivalent to open-input-file.
Authors
Version history
- 0.6
- small improvements in the test suite
- 0.2
- removed optional args from open-memory-mapped-input-file
- 0.1
- initial release
License
Copyright (c) 2011, Felix L. Winkelmann All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.