ians@users.sourceforge.net
Some key features:
Within the root directory is a test directory. I recommend that you get the test programs to build and execute in order to verify proper functionality on your platform.
In a perfect world, you would unpack the tar-ball, and do:
make make test > test.out diff -c ./test.out ./test.out.goldenIf there are minimal differences (addresses are bound to be different) then the library is probably good to go. Simply copy the library and view.h to a convenient location and start using them.
Implementation
Example: Given the following set of string segments:
seg-a: fu seg-b: bar seg-c: snatch
A view might look like:
s n a f u b a r _ _ _ _ _ _ _ _ c c c a a b b b segment-id 0 1 2 0 1 0 1 2 segment-index
Which is achieved with a set of 3-tuples that look like:
[ addr-seg-c, 0, 1 ] [ addr-seg-a, 0, 1 ] [ addr-seg-b, 0, 2 ]
The important distinction is that a view that owns its data can be used irrespective of the program scope, or the life-cycle of the data that was used to create it. However, a view that borrows its data must be carefully used. If the data it points to is destroyed before the view is destroyed, behavior is undefined (most likely very bad).
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2: 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.
THIS SOFTWARE IS PROVIDED ``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 IAN SEARLE 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.