((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/buffer-ports" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "buffer-ports" (toc)) (section 2 "Introduction" (p "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.") (section 3 "open-input-buffer" (def (sig (procedure "(open-input-buffer THING [LENGTH [START]])" (id open-input-buffer))) (p "Creates and returns an input port. " (tt "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 " (tt "THING") ". The option " (tt "LENGTH") " and " (tt "START") " arguments can be used to limit the length of the data and the starting position.") (p "If " (tt "THING") " is a pointer, locative or memory mapped file, then " (tt "LENGTH") " must be specified and will not be checked for being valid."))) (section 3 "open-output-buffer" (def (sig (procedure "(open-output-buffer THING [LENGTH [START]])" (id open-output-buffer))) (p "Returns an output-port over the object " (tt "THING") ". Otherwise similar to " (tt "open-input-buffer") "."))) (section 3 "open-memory-mapped-input-file" (def (sig (procedure "(open-memory-mapped-input-file FILENAME)" (id open-memory-mapped-input-file))) (p "A convenience function for opening a file in a memory-mapped buffer. On Windows, this procedure is equivalent to " (tt "open-input-file") ".")))) (section 2 "Authors" (p (int-link "/users/felix winkelmann"))) (section 2 "Version history" (dl (dt "0.6") (dd "small improvements in the test suite") (dt "0.2") (dd "removed optional args from " (tt "open-memory-mapped-input-file")) (dt "0.1") (dd "initial release"))) (section 2 "License" (pre "Copyright (c) 2011, Felix L. Winkelmann\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following\nconditions are met:\n\n  Redistributions of source code must retain the above copyright notice, this list of conditions and the following\n    disclaimer. \n  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following\n    disclaimer in the documentation and/or other materials provided with the distribution. \n  Neither the name of the author nor the names of its contributors may be used to endorse or promote\n    products derived from this software without specific prior written permission. \n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS\nOR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\nOTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.")))