Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mentions of CAMLprim from the manual #9153

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -86,7 +86,7 @@ functions and macros are described in detail below. For instance,
here is the declaration for the C function implementing the "input"
primitive:
\begin{verbatim}
CAMLprim value input(value channel, value buffer, value offset, value length)
value input(value channel, value buffer, value offset, value length)
{
...
}
@@ -106,13 +106,13 @@ to be used in conjunction with the native-code compiler "ocamlopt",
takes its arguments directly. For instance, here are the two C
functions for the 7-argument primitive "Nat.add_nat":
\begin{verbatim}
CAMLprim value add_nat_native(value nat1, value ofs1, value len1,
value nat2, value ofs2, value len2,
value carry_in)
value add_nat_native(value nat1, value ofs1, value len1,
value nat2, value ofs2, value len2,
value carry_in)
{
...
}
CAMLprim value add_nat_bytecode(value * argv, int argn)
value add_nat_bytecode(value * argv, int argn)
{
return add_nat_native(argv[0], argv[1], argv[2], argv[3],
argv[4], argv[5], argv[6]);
@@ -144,17 +144,15 @@ call the first function, and convert the returned C value to OCaml
value. For instance, here is the stub code for the "input"
primitive:
\begin{verbatim}
CAMLprim value input(value channel, value buffer, value offset, value length)
value input(value channel, value buffer, value offset, value length)
{
return Val_long(getblock((struct channel *) channel,
&Byte(buffer, Long_val(offset)),
Long_val(length)));
}
\end{verbatim}
(Here, "Val_long", "Long_val" and so on are conversion macros for the
type "value", that will be described later. The "CAMLprim" macro
expands to the required compiler directives to ensure that the
function is exported and accessible from OCaml.)
type "value", that will be described later.)
The hard work is performed by the function "getblock", which is
declared as:
\begin{verbatim}
@@ -1456,7 +1454,7 @@ example, if the OCaml code contains the declaration
\end{verbatim}
the corresponding C stub can be written as follows:
\begin{verbatim}
CAMLprim value caml_apply(value vf, value vx)
value caml_apply(value vf, value vx)
{
CAMLparam2(vf, vx);
CAMLlocal1(vy);
@@ -2236,12 +2234,12 @@ external foo
In this case the C functions must look like:

\begin{verbatim}
CAMLprim double foo(double a, double b)
double foo(double a, double b)
{
...
}

CAMLprim value foo_byte(value a, value b)
value foo_byte(value a, value b)
{
return caml_copy_double(foo(Double_val(a), Double_val(b)))
}
@@ -2399,7 +2397,7 @@ IP address of a host name. The "gethostbyname" function can block for
a long time, so we choose to release the OCaml run-time system while it
is running.
\begin{verbatim}
CAMLprim stub_gethostbyname(value vname)
value stub_gethostbyname(value vname)
{
CAMLparam1 (vname);
CAMLlocal1 (vres);
@@ -2576,7 +2574,7 @@ The rest of the binding is the same for both platforms:
#include <caml/osdeps.h>
#include <stdlib.h>

CAMLprim value stub_getenv(value var_name)
value stub_getenv(value var_name)
{
CAMLparam1(var_name);
CAMLlocal1(var_value);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.