caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Announcement: pa_bounds
@ 2006-03-13  6:40 Martin Jambon
  0 siblings, 0 replies; only message in thread
From: Martin Jambon @ 2006-03-13  6:40 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-13  6:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-13  6:40 Announcement: pa_bounds Martin Jambon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).