interop.c
Include dependency graph for interop.c:
Functions
-
inline InteropFunctionResult interop_chardata_fold(term t, interop_chardata_fold_fun fold_fun, interop_chardata_rest_fun rest_fun, void *accum)
-
static inline InteropFunctionResult size_fold_fun(term t, void *accum)
-
InteropFunctionResult interop_iolist_size(term t, size_t *size)
-
static inline InteropFunctionResult write_string_fold_fun(term t, void *accum)
-
InteropFunctionResult interop_write_iolist(term t, char *p)
-
static enum UnicodeConversionResult interop_binary_conversion(term t, uint8_t *output, size_t *output_len, size_t *rest_crsr, enum CharDataEncoding in_encoding, enum CharDataEncoding out_encoding)
-
static InteropFunctionResult chardata_to_bytes_size_fold_fun(term t, void *accum)
-
enum UnicodeConversionResult interop_chardata_to_bytes_size(term t, size_t *size, size_t *rest_size, enum CharDataEncoding in_encoding, enum CharDataEncoding out_encoding)
-
static InteropFunctionResult chardata_to_bytes_fold_fun(term t, void *accum)
-
enum UnicodeConversionResult interop_chardata_to_bytes(term t, uint8_t *output, term *rest, enum CharDataEncoding in_encoding, enum CharDataEncoding out_encoding, Heap *heap)
-
term interop_map_get_value(GlobalContext *glb, term map, term key)
-
int interop_atom_term_select_int(const AtomStringIntPair *table, term atom, GlobalContext *global)
Finds on a table the first matching atom string.
Allows to quickly translate atoms to any integer constant. This function is useful for creating switch statements for atom values. A linear search is performed, so table entries should be sorted by frequency.
- Parameters:
table – an array AtomStringIntPair structs, terminated with a default entry marked with SELECT_INT_DEFAULT macro.
atom – the atom used for comparison.
global – the global context.
- Returns:
the found int value which corresponds to the given atom.
-
term interop_kv_get_value_default(term kv, AtomString key, term default_value, GlobalContext *glb)
Get a value given a key (as AtomString) from any proplist or map.
This function allows to easily get values from proplists or maps, without poluting the atom table.
- Parameters:
kv – any proplist or map.
key – an AtomString, such as ATOM_STR(“\x3”, “key”).
default_value – that is returned in case of missing item.
glb – the global context.
- Returns:
the value term in case given key exists, otherwise the default_value.
-
term interop_atom_term_select_atom(const AtomStringIntPair *table, int value, GlobalContext *global)
Finds the first matching atom in an atoms table .
Allows to quickly translate integer constants to an atom in an atoms table. This function is the inverse of interop_atom_term_select_int.
- Parameters:
table – an array AtomStringIntPair structs, terminated with a default entry marked with SELECT_INT_DEFAULT macro.
value – the in value used for comparison.
global – the global context.
- Returns:
the found atom which corresponds to the given int value, or the invalid term, if there is no such value in the table.
-
struct CharDataToBytesSizeAcc
Public Members
-
enum CharDataEncoding in_encoding
-
enum CharDataEncoding out_encoding
-
size_t size
-
size_t rest_size
-
bool badarg
-
bool incomplete_transform
-
enum CharDataEncoding in_encoding
-
struct CharDataToBytesAcc
Collaboration diagram for CharDataToBytesAcc: