pa_bounds syntax extension ========================== What it provides: ---------------- The default behavior of out-of-bounds array, string or bigarray accesses is to raise the Invalid_argument exception, with no information on where the faulty access was attempted. This Camlp4 module provides a special syntax which allows the illegal accesses to be reported accurately, by indicating the location in the source code. The same exception, Invalid_argument, is raised, but its argument is a string which contains that information. The syntax: ---------- Replace the dot (.) by the number sign (#), e.g.: native extension a.(i) a#(i) a.(i) <- e a#(i) <- e s.[i] s#[i] s.[i] <- c s#[i] <- c big.{i,j} big#{i,j} big.{i,j} <- x big#{i,j} <- x It should also work with the revised syntax, where ":=" replaces "<-". Options: ------- -native The native behavior can be restored without changing the program by passing the -native option to the preprocessor. For unsafe access without bound checking, this option must be used in addition to the -unsafe option that can be passed to the compiler (ocamlopt or ocamlc). Installation: ------------ Install Findlib and P4ck, and then install it from P4ck. Alternatively, you can compile the extension as follows: camlp4o -o ocamlc -c \ -pp 'camlp4o pa_extend.cmo q_MLast.cmo -loc _loc' \ -I +camlp4 pa_bounds.ml See http://www.ocaml-tutorial.org/compiling_ocaml_projects for information on how to compile programs that use Camlp4 extensions. License: ------- Copyright (c) 2006 Martin Jambon All rights reserved. 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. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.