Version française
Home     About     Download     Resources     Contact us    
Browse thread
Announcement: pa_bounds
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin_jambon@e...>
Subject: Announcement: pa_bounds
As suggested by Rich Jones, here is a better description of this new 
syntax extension:

                   pa_bounds syntax extension
                   ==========================

Location-specific reports of out-of-bounds accesses in arrays, strings and 
bigarrays.

http://martin.jambon.free.fr/ocaml.html#bounds


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:
-------
BSD-style, see http://martin.jambon.free.fr/pa_bounds/pa_bounds.ml.html



Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr

Edit http://wikiomics.org, bioinformatics wiki