This module contains functions for creating and manipulating Erlang terms.
An Erlang term is represented by a C structure of type
The following macros each take a single ETERM pointer as an argument. They return a non-zero value if the test is true, and 0 otherwise:
The following macros can be used for retrieving parts of Erlang terms. None of these do any type checking; results are undefined if you pass an ETERM* containing the wrong type. For example, passing a tuple to ERL_ATOM_PTR() will likely result in garbage.
This function concatenates two Erlang terms, prepending
The function returns a new list.
For example:
This function creates and returns a copy of the Erlang term
This function extracts a specified element from an Erlang tuple.
The function returns a new Erlang term corresponding to the
requested element, or NULL if
This function must be called before any of the others in
the
Extracts the first element from a list.
The function returns an Erlang term corresponding to the
head element in the list, or a NULL pointer if
This function converts an IO list to a binary term.
This function an Erlang binary term, or NULL if
Informally, an IO list is a deep list of characters and binaries which can be sent to an Erlang port. In BNF, an IO list is formally defined as follows:
This function converts an IO list to a '\0' terminated C string.
This function returns a pointer to a dynamically allocated
buffer containing a string. If
Refer to
Returns the length of an IO list.
The function returns the length of
Refer to
Determines the length of a proper list.
Returns -1 if
Creates an atom.
Returns an Erlang term containing an atom. Note that it is
the callers responsibility to make sure that
Note that the UTF8 variants were introduced in Erlang/OTP releases R16
and the string returned by
This function produces an Erlang binary object from a buffer containing a sequence of bytes.
The function returns an Erlang binary object.
This function creates and returns an empty Erlang list. Note that NULL is not used to represent an empty list; Use this function instead.
This function creates a list from a sequence of bytes.
The function returns an Erlang list object corresponding to
the character sequence in
Creates an Erlang float.
The function returns an Erlang float object with the value
specified in
Creates an Erlang integer.
The function returns an Erlang integer object with the
value specified in
Creates an Erlang list from an array of Erlang terms, such that each element in the list corresponds to one element in the array.
The function creates an Erlang list object, whose length
This function creates an Erlang process identifier. The resulting pid can be used by Erlang processes wishing to communicate with the C node.
The function returns an Erlang pid object.
This function creates an Erlang port identifier.
The function returns an Erlang port object.
This function creates an old Erlang reference, with
only 18 bits - use
Note that
The function returns an Erlang reference object.
This function creates an Erlang reference, with 82 bits.
Note that
The function returns an Erlang reference object.
This function creates a list from a zero terminated string.
The function returns an Erlang list.
Creates an Erlang tuple from an array of Erlang terms.
The function creates an Erlang tuple, whose arity is
To retrieve the size of a tuple, either use the
Creates an Erlang unsigned integer.
The function returns an Erlang unsigned integer object with
the value specified in
This function creates an unbound Erlang variable. The variable can later be bound through pattern matching or assignment.
The function returns an Erlang variable object with the
name
This function prints the specified Erlang term to the given output stream.
The function returns the number of characters written, or a negative value if there was an error.
By default, the
A call to
If this function is called, it may only be called once
directly after the call to the
You may run into trouble if this feature is used carelessly. Always make sure that all communicating components are either from the same Erlang/OTP release, or from release X and release Y where all components from release Y are in compatibility mode of release X.
Returns the arity of an Erlang tuple, or the number of bytes in an Erlang binary object.
The function returns the size of
Extracts the tail from a list.
The function returns an Erlang list corresponding to the
original list minus the first element, or NULL pointer if
This function returns the contents of the specified variable in an Erlang term.
Returns the Erlang object corresponding to the value of