Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 87d522c5529b79bcd1df9cb27fffa7cca6270c32 Mon Sep 17 00:00:00 2001
- From: Gabriel Scherer <gabriel.scherer@inria.fr>
- Date: Wed, 7 Aug 2013 14:03:45 +0200
- Subject: [PATCH] PR#6126: in the Bigarray description, use the new `caml_ba`
- prefix
- ---
- manual/library/libbigarray.etex | 60 +++++++++++++++++++--------------------
- 1 file changed, 30 insertions(+), 30 deletions(-)
- diff --git a/manual/library/libbigarray.etex b/manual/library/libbigarray.etex
- index e6e6adf..b0a0568 100644
- --- a/manual/library/libbigarray.etex
- +++ b/manual/library/libbigarray.etex
- @@ -75,29 +75,29 @@ below.
- \subsection{Accessing an OCaml bigarray from C or Fortran}
- If \var{v} is a OCaml "value" representing a big array, the expression
- -"Data_bigarray_val("\var{v}")" returns a pointer to the data part of the array.
- +"Caml_ba_data_val("\var{v}")" returns a pointer to the data part of the array.
- This pointer is of type "void *" and can be cast to the appropriate C
- type for the array (e.g. "double []", "char [][10]", etc).
- Various characteristics of the OCaml big array can be consulted from C
- as follows:
- \begin{tableau}{|l|l|}{C expression}{Returns}
- -\entree{"Bigarray_val("\var{v}")->num_dims"}{number of dimensions}
- -\entree{"Bigarray_val("\var{v}")->dim["\var{i}"]"}{\var{i}-th dimension}
- -\entree{"Bigarray_val("\var{v}")->flags & BIGARRAY_KIND_MASK"}{kind of array elements}
- +\entree{"Caml_ba_array_val("\var{v}")->num_dims"}{number of dimensions}
- +\entree{"Caml_ba_array_val("\var{v}")->dim["\var{i}"]"}{\var{i}-th dimension}
- +\entree{"Caml_ba_array_val("\var{v}")->flags & BIGARRAY_KIND_MASK"}{kind of array elements}
- \end{tableau}
- The kind of array elements is one of the following constants:
- \begin{tableau}{|l|l|}{Constant}{Element kind}
- -\entree{"BIGARRAY_FLOAT32"}{32-bit single-precision floats}
- -\entree{"BIGARRAY_FLOAT64"}{64-bit double-precision floats}
- -\entree{"BIGARRAY_SINT8"}{8-bit signed integers}
- -\entree{"BIGARRAY_UINT8"}{8-bit unsigned integers}
- -\entree{"BIGARRAY_SINT16"}{16-bit signed integers}
- -\entree{"BIGARRAY_UINT16"}{16-bit unsigned integers}
- -\entree{"BIGARRAY_INT32"}{32-bit signed integers}
- -\entree{"BIGARRAY_INT64"}{64-bit signed integers}
- -\entree{"BIGARRAY_CAML_INT"}{31- or 63-bit signed integers}
- -\entree{"BIGARRAY_NATIVE_INT"}{32- or 64-bit (platform-native) integers}
- +\entree{"CAML_BA_FLOAT32"}{32-bit single-precision floats}
- +\entree{"CAML_BA_FLOAT64"}{64-bit double-precision floats}
- +\entree{"CAML_BA_SINT8"}{8-bit signed integers}
- +\entree{"CAML_BA_UINT8"}{8-bit unsigned integers}
- +\entree{"CAML_BA_SINT16"}{16-bit signed integers}
- +\entree{"CAML_BA_UINT16"}{16-bit unsigned integers}
- +\entree{"CAML_BA_INT32"}{32-bit signed integers}
- +\entree{"CAML_BA_INT64"}{64-bit signed integers}
- +\entree{"CAML_BA_CAML_INT"}{31- or 63-bit signed integers}
- +\entree{"CAML_BA_NATIVE_INT"}{32- or 64-bit (platform-native) integers}
- \end{tableau}
- %
- The following example shows the passing of a two-dimensional big array
- @@ -108,12 +108,12 @@ to a C function and a Fortran function.
- value caml_stub(value bigarray)
- {
- - int dimx = Bigarray_val(bigarray)->dim[0];
- - int dimy = Bigarray_val(bigarray)->dim[1];
- + int dimx = Caml_ba_array_val(bigarray)->dim[0];
- + int dimy = Caml_ba_array_val(bigarray)->dim[1];
- /* C passes scalar parameters by value */
- - my_c_function(Data_bigarray_val(bigarray), dimx, dimy);
- + my_c_function(Caml_ba_data_val(bigarray), dimx, dimy);
- /* Fortran passes all parameters by reference */
- - my_fortran_function_(Data_bigarray_val(bigarray), &dimx, &dimy);
- + my_fortran_function_(Caml_ba_data_val(bigarray), &dimx, &dimy);
- return Val_unit;
- }
- \end{verbatim}
- @@ -121,25 +121,25 @@ to a C function and a Fortran function.
- \subsection{Wrapping a C or Fortran array as an OCaml big array}
- A pointer \var{p} to an already-allocated C or Fortran array can be
- -wrapped and returned to OCaml as a big array using the "alloc_bigarray"
- -or "alloc_bigarray_dims" functions.
- +wrapped and returned to OCaml as a big array using the "caml_ba_alloc"
- +or "caml_ba_alloc_dims" functions.
- \begin{itemize}
- \item
- -"alloc_bigarray("\var{kind} "|" \var{layout}, \var{numdims}, \var{p}, \var{dims}")"
- +"caml_ba_alloc("\var{kind} "|" \var{layout}, \var{numdims}, \var{p}, \var{dims}")"
- Return an OCaml big array wrapping the data pointed to by \var{p}.
- -\var{kind} is the kind of array elements (one of the "BIGARRAY_"
- -kind constants above). \var{layout} is "BIGARRAY_C_LAYOUT" for an
- -array with C layout and "BIGARRAY_FORTRAN_LAYOUT" for an array with
- +\var{kind} is the kind of array elements (one of the "CAML_BA_"
- +kind constants above). \var{layout} is "CAML_BA_C_LAYOUT" for an
- +array with C layout and "CAML_BA_FORTRAN_LAYOUT" for an array with
- Fortran layout. \var{numdims} is the number of dimensions in the
- array. \var{dims} is an array of \var{numdims} long integers, giving
- the sizes of the array in each dimension.
- \item
- -"alloc_bigarray_dims("\var{kind} "|" \var{layout}, \var{numdims},
- +"caml_ba_alloc_dims("\var{kind} "|" \var{layout}, \var{numdims},
- \var{p}, "(long) "\nth{dim}{1}, "(long) "\nth{dim}{2}, \ldots, "(long) "\nth{dim}{numdims}")"
- -Same as "alloc_bigarray", but the sizes of the array in each dimension
- +Same as "caml_ba_alloc", but the sizes of the array in each dimension
- are listed as extra arguments in the function call, rather than being
- passed as an array.
- \end{itemize}
- @@ -154,14 +154,14 @@ Fortran arrays can be made available to OCaml.
- {
- long dims[2];
- dims[0] = 100; dims[1] = 200;
- - return alloc_bigarray(BIGARRAY_NATIVE_INT | BIGARRAY_C_LAYOUT,
- - 2, my_c_array, dims);
- + return caml_ba_alloc(CAML_BA_NATIVE_INT | CAML_BA_C_LAYOUT,
- + 2, my_c_array, dims);
- }
- value caml_get_fortran_array(value unit)
- {
- - return alloc_bigarray_dims(BIGARRAY_FLOAT32 | BIGARRAY_FORTRAN_LAYOUT,
- - 2, my_fortran_array_, 300L, 400L);
- + return caml_ba_alloc_dims(CAML_BA_FLOAT32 | CAML_BA_FORTRAN_LAYOUT,
- + 2, my_fortran_array_, 300L, 400L);
- }
- \end{verbatim}
- --
- 1.7.10.4
Add Comment
Please, Sign In to add comment