interop.c
Include dependency graph for interop.c:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"9" [label="stdbool.h" tooltip="stdbool.h"]
"28" [label="bitstring.h" tooltip="bitstring.h"]
"6" [label="atom.h" tooltip="atom.h"]
"12" [label="assert.h" tooltip="assert.h"]
"20" [label="synclist.h" tooltip="synclist.h"]
"29" [label="defaultatoms.h" tooltip="defaultatoms.h"]
"30" [label="tempstack.h" tooltip="tempstack.h"]
"5" [label="stdint.h" tooltip="stdint.h"]
"7" [label="stdlib.h" tooltip="stdlib.h"]
"31" [label="valueshashtable.h" tooltip="valueshashtable.h"]
"3" [label="context.h" tooltip="context.h"]
"17" [label="utils.h" tooltip="utils.h"]
"8" [label="atom_table.h" tooltip="atom_table.h"]
"11" [label="term_typedef.h" tooltip="term_typedef.h"]
"18" [label="stddef.h" tooltip="stddef.h"]
"13" [label="limits.h" tooltip="limits.h"]
"25" [label="refc_binary.h" tooltip="refc_binary.h"]
"23" [label="string.h" tooltip="string.h"]
"16" [label="mailbox.h" tooltip="mailbox.h"]
"22" [label="term.h" tooltip="term.h"]
"10" [label="erl_nif.h" tooltip="erl_nif.h"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" fillcolor="#BFBFBF"]
"2" [label="interop.h" tooltip="interop.h"]
"26" [label="resources.h" tooltip="resources.h"]
"19" [label="smp.h" tooltip="smp.h"]
"4" [label="globalcontext.h" tooltip="globalcontext.h"]
"24" [label="memory.h" tooltip="memory.h"]
"21" [label="stdio.h" tooltip="stdio.h"]
"27" [label="timer_list.h" tooltip="timer_list.h"]
"15" [label="list.h" tooltip="list.h"]
"14" [label="inttypes.h" tooltip="inttypes.h"]
"28" -> "22" [dir=forward tooltip="include"]
"28" -> "9" [dir=forward tooltip="include"]
"28" -> "5" [dir=forward tooltip="include"]
"6" -> "5" [dir=forward tooltip="include"]
"6" -> "7" [dir=forward tooltip="include"]
"20" -> "15" [dir=forward tooltip="include"]
"20" -> "21" [dir=forward tooltip="include"]
"20" -> "19" [dir=forward tooltip="include"]
"29" -> "4" [dir=forward tooltip="include"]
"30" -> "11" [dir=forward tooltip="include"]
"30" -> "17" [dir=forward tooltip="include"]
"3" -> "4" [dir=forward tooltip="include"]
"3" -> "15" [dir=forward tooltip="include"]
"3" -> "16" [dir=forward tooltip="include"]
"3" -> "19" [dir=forward tooltip="include"]
"3" -> "22" [dir=forward tooltip="include"]
"3" -> "27" [dir=forward tooltip="include"]
"17" -> "18" [dir=forward tooltip="include"]
"8" -> "9" [dir=forward tooltip="include"]
"8" -> "6" [dir=forward tooltip="include"]
"11" -> "12" [dir=forward tooltip="include"]
"11" -> "13" [dir=forward tooltip="include"]
"11" -> "14" [dir=forward tooltip="include"]
"11" -> "5" [dir=forward tooltip="include"]
"25" -> "9" [dir=forward tooltip="include"]
"25" -> "7" [dir=forward tooltip="include"]
"25" -> "15" [dir=forward tooltip="include"]
"25" -> "26" [dir=forward tooltip="include"]
"16" -> "9" [dir=forward tooltip="include"]
"16" -> "15" [dir=forward tooltip="include"]
"16" -> "11" [dir=forward tooltip="include"]
"16" -> "17" [dir=forward tooltip="include"]
"22" -> "9" [dir=forward tooltip="include"]
"22" -> "5" [dir=forward tooltip="include"]
"22" -> "21" [dir=forward tooltip="include"]
"22" -> "7" [dir=forward tooltip="include"]
"22" -> "23" [dir=forward tooltip="include"]
"22" -> "24" [dir=forward tooltip="include"]
"22" -> "25" [dir=forward tooltip="include"]
"22" -> "17" [dir=forward tooltip="include"]
"22" -> "11" [dir=forward tooltip="include"]
"10" -> "11" [dir=forward tooltip="include"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "8" [dir=forward tooltip="include"]
"1" -> "28" [dir=forward tooltip="include"]
"1" -> "29" [dir=forward tooltip="include"]
"1" -> "30" [dir=forward tooltip="include"]
"1" -> "22" [dir=forward tooltip="include"]
"1" -> "11" [dir=forward tooltip="include"]
"1" -> "31" [dir=forward tooltip="include"]
"1" -> "5" [dir=forward tooltip="include"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "22" [dir=forward tooltip="include"]
"26" -> "7" [dir=forward tooltip="include"]
"26" -> "10" [dir=forward tooltip="include"]
"26" -> "15" [dir=forward tooltip="include"]
"26" -> "24" [dir=forward tooltip="include"]
"19" -> "9" [dir=forward tooltip="include"]
"4" -> "5" [dir=forward tooltip="include"]
"4" -> "6" [dir=forward tooltip="include"]
"4" -> "8" [dir=forward tooltip="include"]
"4" -> "10" [dir=forward tooltip="include"]
"4" -> "15" [dir=forward tooltip="include"]
"4" -> "16" [dir=forward tooltip="include"]
"4" -> "19" [dir=forward tooltip="include"]
"4" -> "20" [dir=forward tooltip="include"]
"4" -> "22" [dir=forward tooltip="include"]
"4" -> "27" [dir=forward tooltip="include"]
"24" -> "10" [dir=forward tooltip="include"]
"24" -> "11" [dir=forward tooltip="include"]
"24" -> "17" [dir=forward tooltip="include"]
"24" -> "5" [dir=forward tooltip="include"]
"24" -> "7" [dir=forward tooltip="include"]
"27" -> "9" [dir=forward tooltip="include"]
"27" -> "5" [dir=forward tooltip="include"]
"27" -> "15" [dir=forward tooltip="include"]
}](../../../_images/graphviz-7136c2541c96b6b055a926479a7a989d2acaf276.png)
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: