From 7e064720c1363ee4ca4209d7c8b0f33a90182ce7 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 5 Apr 2019 18:26:45 +0200 Subject: erl_interface: Deprecate ei_encode_term and ei_decode_term as they use ETERM which is part of legacy erl_interface. --- lib/erl_interface/doc/src/ei.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/erl_interface/doc/src') diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml index f081ca926a..26fe6f8831 100644 --- a/lib/erl_interface/doc/src/ei.xml +++ b/lib/erl_interface/doc/src/ei.xml @@ -349,8 +349,10 @@ typedef enum { t is actually an ETERM** (see erl_eterm). The term is later to be deallocated.

-

Notice that this function is located in the Erl_Interface - library.

+

This function is deprecated as of OTP 22 and will be removed in + OTP 23 together with the old legacy erl_interface library (functions + with prefix erl_).

+
@@ -656,6 +658,10 @@ ei_x_encode_string(&x, "Banana"); erl_interface. Parameter t is actually an ETERM pointer. This function does not free the ETERM.

+

These functions are deprecated as of OTP 22 and will be removed in + OTP 23 together with the old legacy erl_interface library + (functions with prefix erl_).

+
-- cgit v1.2.3 From 73e1334e1d4fa8ffbfe9462ea6bdcbbcdf519566 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Fri, 5 Apr 2019 19:28:01 +0200 Subject: erl_interface: Fix maps arity from ei_get_type() --- lib/erl_interface/doc/src/ei.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/erl_interface/doc/src') diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml index 26fe6f8831..d0d472c42b 100644 --- a/lib/erl_interface/doc/src/ei.xml +++ b/lib/erl_interface/doc/src/ei.xml @@ -731,12 +731,12 @@ ei_encode_tuple_header(buf, &i, 0); intei_get_type(const char *buf, const int *index, int *type, int *size) Fetch the type and size of an encoded term. -

Returns the type in type and size in - size of the encoded term. For strings and atoms, +

Returns the type in *type and size in + *size of the encoded term. For strings and atoms, size is the number of characters not including the - terminating NULL. For binaries, size is the number of - bytes. For lists and tuples, size is the arity of - the object. For other types, size is 0. In all + terminating NULL. For binaries and bitstrings, *size is + the number of bytes. For lists, tuples and maps, *size is the + arity of the object. For other types, *size is 0. In all cases, index is left unchanged.

-- cgit v1.2.3 From 6465de7e3a5393a80ed0e2c63f012fd126de706f Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 3 Apr 2019 21:16:59 +0200 Subject: erl_interface: Add bitstring and export fun support --- lib/erl_interface/doc/src/ei.xml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'lib/erl_interface/doc/src') diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml index d0d472c42b..254ae27cc8 100644 --- a/lib/erl_interface/doc/src/ei.xml +++ b/lib/erl_interface/doc/src/ei.xml @@ -182,6 +182,35 @@ typedef enum { + + intei_decode_bitstring(const char *buf, int *index, void *p, size_t plen, size_t *bitsp) + Decode a bitstring. + +

Decodes a bitstring from the binary format.

+ + p +

Either NULL or points to a buffer where the bytes of the + bitstring will be written.

+
+ plen +

The max size of the bitstring in bytes, that is the + size of the buffer if p != NULL.

+
+ *bitsp +

If bitsp is not NULL, set to the actual + number of bits of the bitstring.

+
+
+

Returns 0 if it was a bitstring no longer than plen + bytes. The actual length of the bitstring will be + (*bitsp+7)/8 bytes. If (*bitsp % 8) > 0 only the high + (*bitsp % 8) bits of the last byte are significant.

+

Number of bits may be divisible by 8, which means a binary + decodable by ei_decode_binary is also decodable by + ei_decode_bitstring.

+
+
+ intei_decode_boolean(const char *buf, int *index, int *p) Decode a boolean. @@ -460,6 +489,18 @@ typedef enum { + + intei_encode_bitstring(char *buf, int *index, const void *p, size_t bits) + intei_x_encode_bitstring(ei_x_buff* x, const void *p, size_t bits) + Encode a bitstring. + +

Encodes a bitstring in the binary format. The data is at + p. The size of the data is bits bits or + (bits+7)/8 bytes. If (bits%8) > 0 only the high + (bits%8) bits of the last byte are significant.

+
+
+ intei_encode_boolean(char *buf, int *index, int p) intei_x_encode_boolean(ei_x_buff* x, int p) -- cgit v1.2.3