term.h

Include dependency graph for term.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="stdbool.h" tooltip="stdbool.h"]
    "10" [label="assert.h" tooltip="assert.h"]
    "3" [label="stdint.h" tooltip="stdint.h"]
    "5" [label="stdlib.h" tooltip="stdlib.h"]
    "13" [label="utils.h" tooltip="utils.h"]
    "9" [label="term_typedef.h" tooltip="term_typedef.h"]
    "14" [label="stddef.h" tooltip="stddef.h"]
    "11" [label="limits.h" tooltip="limits.h"]
    "15" [label="refc_binary.h" tooltip="refc_binary.h"]
    "6" [label="string.h" tooltip="string.h"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.h" fillcolor="#BFBFBF"]
    "8" [label="erl_nif.h" tooltip="erl_nif.h"]
    "17" [label="resources.h" tooltip="resources.h"]
    "7" [label="memory.h" tooltip="memory.h"]
    "4" [label="stdio.h" tooltip="stdio.h"]
    "16" [label="list.h" tooltip="list.h"]
    "12" [label="inttypes.h" tooltip="inttypes.h"]
    "13" -> "14" [dir=forward tooltip="include"]
    "13" -> "4" [dir=forward tooltip="include"]
    "13" -> "5" [dir=forward tooltip="include"]
    "9" -> "10" [dir=forward tooltip="include"]
    "9" -> "11" [dir=forward tooltip="include"]
    "9" -> "12" [dir=forward tooltip="include"]
    "9" -> "3" [dir=forward tooltip="include"]
    "15" -> "2" [dir=forward tooltip="include"]
    "15" -> "5" [dir=forward tooltip="include"]
    "15" -> "16" [dir=forward tooltip="include"]
    "15" -> "17" [dir=forward tooltip="include"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
    "1" -> "4" [dir=forward tooltip="include"]
    "1" -> "5" [dir=forward tooltip="include"]
    "1" -> "6" [dir=forward tooltip="include"]
    "1" -> "7" [dir=forward tooltip="include"]
    "1" -> "15" [dir=forward tooltip="include"]
    "1" -> "13" [dir=forward tooltip="include"]
    "1" -> "9" [dir=forward tooltip="include"]
    "8" -> "9" [dir=forward tooltip="include"]
    "17" -> "5" [dir=forward tooltip="include"]
    "17" -> "8" [dir=forward tooltip="include"]
    "17" -> "16" [dir=forward tooltip="include"]
    "17" -> "7" [dir=forward tooltip="include"]
    "7" -> "3" [dir=forward tooltip="include"]
    "7" -> "5" [dir=forward tooltip="include"]
    "7" -> "8" [dir=forward tooltip="include"]
    "7" -> "9" [dir=forward tooltip="include"]
    "7" -> "13" [dir=forward tooltip="include"]
}

This graph shows which files directly or indirectly include term.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "42" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
    "10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "43" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.h"]
    "4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.c"]
    "3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bitstring.h"]
    "29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "45" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "50" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
    "24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h"]
    "40" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "44" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/exportedfunction.h"]
    "8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h"]
    "38" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "39" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "51" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/overflow_helpers.h"]
    "31" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "41" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "49" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
    "48" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
    "27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.h" fillcolor="#BFBFBF"]
    "6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
    "22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "37" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
    "21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "34" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
    "25" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "35" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
    "15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "32" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "33" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "47" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
    "14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "36" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
    "46" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.h"]
    "10" -> "2" [dir=back tooltip="include"]
    "10" -> "11" [dir=back tooltip="include"]
    "10" -> "7" [dir=back tooltip="include"]
    "43" -> "2" [dir=back tooltip="include"]
    "43" -> "8" [dir=back tooltip="include"]
    "43" -> "42" [dir=back tooltip="include"]
    "43" -> "14" [dir=back tooltip="include"]
    "43" -> "7" [dir=back tooltip="include"]
    "43" -> "17" [dir=back tooltip="include"]
    "43" -> "20" [dir=back tooltip="include"]
    "3" -> "4" [dir=back tooltip="include"]
    "3" -> "5" [dir=back tooltip="include"]
    "3" -> "6" [dir=back tooltip="include"]
    "3" -> "7" [dir=back tooltip="include"]
    "29" -> "7" [dir=back tooltip="include"]
    "45" -> "16" [dir=back tooltip="include"]
    "45" -> "7" [dir=back tooltip="include"]
    "45" -> "17" [dir=back tooltip="include"]
    "45" -> "19" [dir=back tooltip="include"]
    "50" -> "2" [dir=back tooltip="include"]
    "50" -> "42" [dir=back tooltip="include"]
    "50" -> "16" [dir=back tooltip="include"]
    "50" -> "6" [dir=back tooltip="include"]
    "50" -> "7" [dir=back tooltip="include"]
    "50" -> "26" [dir=back tooltip="include"]
    "50" -> "25" [dir=back tooltip="include"]
    "50" -> "17" [dir=back tooltip="include"]
    "50" -> "18" [dir=back tooltip="include"]
    "50" -> "38" [dir=back tooltip="include"]
    "50" -> "39" [dir=back tooltip="include"]
    "50" -> "19" [dir=back tooltip="include"]
    "50" -> "21" [dir=back tooltip="include"]
    "50" -> "31" [dir=back tooltip="include"]
    "23" -> "24" [dir=back tooltip="include"]
    "23" -> "25" [dir=back tooltip="include"]
    "23" -> "17" [dir=back tooltip="include"]
    "23" -> "18" [dir=back tooltip="include"]
    "40" -> "16" [dir=back tooltip="include"]
    "40" -> "41" [dir=back tooltip="include"]
    "40" -> "7" [dir=back tooltip="include"]
    "40" -> "17" [dir=back tooltip="include"]
    "44" -> "10" [dir=back tooltip="include"]
    "44" -> "28" [dir=back tooltip="include"]
    "44" -> "33" [dir=back tooltip="include"]
    "44" -> "29" [dir=back tooltip="include"]
    "44" -> "45" [dir=back tooltip="include"]
    "9" -> "10" [dir=back tooltip="include"]
    "9" -> "8" [dir=back tooltip="include"]
    "9" -> "12" [dir=back tooltip="include"]
    "9" -> "15" [dir=back tooltip="include"]
    "9" -> "5" [dir=back tooltip="include"]
    "9" -> "16" [dir=back tooltip="include"]
    "9" -> "22" [dir=back tooltip="include"]
    "9" -> "14" [dir=back tooltip="include"]
    "9" -> "11" [dir=back tooltip="include"]
    "9" -> "28" [dir=back tooltip="include"]
    "9" -> "7" [dir=back tooltip="include"]
    "9" -> "33" [dir=back tooltip="include"]
    "9" -> "26" [dir=back tooltip="include"]
    "9" -> "25" [dir=back tooltip="include"]
    "9" -> "17" [dir=back tooltip="include"]
    "9" -> "18" [dir=back tooltip="include"]
    "9" -> "38" [dir=back tooltip="include"]
    "9" -> "39" [dir=back tooltip="include"]
    "9" -> "20" [dir=back tooltip="include"]
    "9" -> "21" [dir=back tooltip="include"]
    "9" -> "40" [dir=back tooltip="include"]
    "9" -> "30" [dir=back tooltip="include"]
    "9" -> "27" [dir=back tooltip="include"]
    "39" -> "24" [dir=back tooltip="include"]
    "39" -> "7" [dir=back tooltip="include"]
    "39" -> "25" [dir=back tooltip="include"]
    "39" -> "17" [dir=back tooltip="include"]
    "39" -> "18" [dir=back tooltip="include"]
    "39" -> "38" [dir=back tooltip="include"]
    "51" -> "2" [dir=back tooltip="include"]
    "30" -> "31" [dir=back tooltip="include"]
    "28" -> "10" [dir=back tooltip="include"]
    "28" -> "11" [dir=back tooltip="include"]
    "28" -> "7" [dir=back tooltip="include"]
    "28" -> "29" [dir=back tooltip="include"]
    "28" -> "30" [dir=back tooltip="include"]
    "28" -> "32" [dir=back tooltip="include"]
    "28" -> "27" [dir=back tooltip="include"]
    "48" -> "49" [dir=back tooltip="include"]
    "48" -> "16" [dir=back tooltip="include"]
    "48" -> "7" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "3" [dir=back tooltip="include"]
    "1" -> "8" [dir=back tooltip="include"]
    "1" -> "9" [dir=back tooltip="include"]
    "1" -> "42" [dir=back tooltip="include"]
    "1" -> "43" [dir=back tooltip="include"]
    "1" -> "44" [dir=back tooltip="include"]
    "1" -> "46" [dir=back tooltip="include"]
    "1" -> "47" [dir=back tooltip="include"]
    "1" -> "24" [dir=back tooltip="include"]
    "1" -> "6" [dir=back tooltip="include"]
    "1" -> "22" [dir=back tooltip="include"]
    "1" -> "14" [dir=back tooltip="include"]
    "1" -> "11" [dir=back tooltip="include"]
    "1" -> "28" [dir=back tooltip="include"]
    "1" -> "7" [dir=back tooltip="include"]
    "1" -> "26" [dir=back tooltip="include"]
    "1" -> "25" [dir=back tooltip="include"]
    "1" -> "17" [dir=back tooltip="include"]
    "1" -> "18" [dir=back tooltip="include"]
    "1" -> "51" [dir=back tooltip="include"]
    "1" -> "39" [dir=back tooltip="include"]
    "1" -> "45" [dir=back tooltip="include"]
    "1" -> "30" [dir=back tooltip="include"]
    "1" -> "27" [dir=back tooltip="include"]
    "22" -> "23" [dir=back tooltip="include"]
    "22" -> "6" [dir=back tooltip="include"]
    "22" -> "7" [dir=back tooltip="include"]
    "22" -> "26" [dir=back tooltip="include"]
    "22" -> "25" [dir=back tooltip="include"]
    "22" -> "17" [dir=back tooltip="include"]
    "22" -> "18" [dir=back tooltip="include"]
    "22" -> "19" [dir=back tooltip="include"]
    "22" -> "27" [dir=back tooltip="include"]
    "37" -> "18" [dir=back tooltip="include"]
    "34" -> "26" [dir=back tooltip="include"]
    "35" -> "25" [dir=back tooltip="include"]
    "15" -> "8" [dir=back tooltip="include"]
    "15" -> "16" [dir=back tooltip="include"]
    "15" -> "14" [dir=back tooltip="include"]
    "15" -> "17" [dir=back tooltip="include"]
    "15" -> "18" [dir=back tooltip="include"]
    "15" -> "19" [dir=back tooltip="include"]
    "15" -> "20" [dir=back tooltip="include"]
    "15" -> "21" [dir=back tooltip="include"]
    "32" -> "8" [dir=back tooltip="include"]
    "32" -> "16" [dir=back tooltip="include"]
    "32" -> "11" [dir=back tooltip="include"]
    "32" -> "7" [dir=back tooltip="include"]
    "32" -> "17" [dir=back tooltip="include"]
    "32" -> "21" [dir=back tooltip="include"]
    "33" -> "11" [dir=back tooltip="include"]
    "33" -> "7" [dir=back tooltip="include"]
    "33" -> "26" [dir=back tooltip="include"]
    "33" -> "34" [dir=back tooltip="include"]
    "33" -> "25" [dir=back tooltip="include"]
    "33" -> "35" [dir=back tooltip="include"]
    "33" -> "17" [dir=back tooltip="include"]
    "33" -> "36" [dir=back tooltip="include"]
    "33" -> "18" [dir=back tooltip="include"]
    "33" -> "37" [dir=back tooltip="include"]
    "33" -> "19" [dir=back tooltip="include"]
    "12" -> "13" [dir=back tooltip="include"]
    "12" -> "14" [dir=back tooltip="include"]
    "47" -> "48" [dir=back tooltip="include"]
    "47" -> "8" [dir=back tooltip="include"]
    "47" -> "9" [dir=back tooltip="include"]
    "47" -> "50" [dir=back tooltip="include"]
    "47" -> "16" [dir=back tooltip="include"]
    "47" -> "14" [dir=back tooltip="include"]
    "47" -> "11" [dir=back tooltip="include"]
    "47" -> "28" [dir=back tooltip="include"]
    "47" -> "7" [dir=back tooltip="include"]
    "47" -> "26" [dir=back tooltip="include"]
    "47" -> "25" [dir=back tooltip="include"]
    "47" -> "35" [dir=back tooltip="include"]
    "47" -> "17" [dir=back tooltip="include"]
    "47" -> "36" [dir=back tooltip="include"]
    "47" -> "18" [dir=back tooltip="include"]
    "47" -> "37" [dir=back tooltip="include"]
    "47" -> "38" [dir=back tooltip="include"]
    "47" -> "39" [dir=back tooltip="include"]
    "47" -> "19" [dir=back tooltip="include"]
    "47" -> "45" [dir=back tooltip="include"]
    "47" -> "40" [dir=back tooltip="include"]
    "47" -> "31" [dir=back tooltip="include"]
    "47" -> "32" [dir=back tooltip="include"]
    "36" -> "17" [dir=back tooltip="include"]
    "36" -> "18" [dir=back tooltip="include"]
    "46" -> "5" [dir=back tooltip="include"]
    "46" -> "11" [dir=back tooltip="include"]
    "46" -> "7" [dir=back tooltip="include"]
}

term manipulation functions

This header implements term manipulation functions.

Defines

TERM_BOXED_VALUE_TAG 0x2
TERM_INTEGER_TAG 0xF
TERM_CATCH_TAG 0x1B
TERM_BOXED_TAG_MASK 0x3F
TERM_BOXED_TUPLE 0x0
TERM_BOXED_BIN_MATCH_STATE 0x4
TERM_BOXED_POSITIVE_INTEGER 0x8
TERM_BOXED_REF 0x10
TERM_BOXED_FUN 0x14
TERM_BOXED_FLOAT 0x18
TERM_BOXED_REFC_BINARY 0x20
TERM_BOXED_HEAP_BINARY 0x24
TERM_BOXED_MAP 0x3C
TERM_BOXED_SUB_BINARY 0x28
TERM_UNUSED 0x2B
TERM_RESERVED_MARKER(x) ((x << 6) | TERM_UNUSED)
TERM_BOXED_REFC_BINARY_SIZE 6
TERM_BOXED_BIN_MATCH_STATE_SIZE 4
TERM_BOXED_SUB_BINARY_SIZE 4
TERM_BOXED_RESOURCE_SIZE TERM_BOXED_REFC_BINARY_SIZE
REFC_BINARY_MIN 32
SUB_BINARY_MIN 8
BINARY_HEADER_SIZE 2
FUNCTION_REFERENCE_SIZE 4
BOXED_INT_SIZE (BOXED_TERMS_REQUIRED_FOR_INT + 1)
BOXED_INT64_SIZE (BOXED_TERMS_REQUIRED_FOR_INT64 + 1)
BOXED_FUN_SIZE 3
FLOAT_SIZE (sizeof(float_term_t) / sizeof(term) + 1)
REF_SIZE ((int) ((sizeof(uint64_t) / sizeof(term)) + 1))
TUPLE_SIZE(elems) ((int) (elems + 1))
CONS_SIZE 2
REFC_BINARY_CONS_OFFSET 4
LIST_SIZE(num_elements, element_size) ((num_elements) * ((element_size) + CONS_SIZE))
TERM_MAP_SIZE(num_elements) (3 + 2 * (num_elements))
TERM_MAP_SHARED_SIZE(num_elements) (2 + (num_elements))
LIST_HEAD_INDEX 1
LIST_TAIL_INDEX 0
TERM_BINARY_SIZE_IS_HEAP(size) ((size) < REFC_BINARY_MIN)
TERM_BINARY_DATA_SIZE_IN_TERMS(size)     (TERM_BINARY_SIZE_IS_HEAP(size) ? (((size) + 4 - 1) >> 2) + 1 : TERM_BOXED_REFC_BINARY_SIZE)
TERM_BINARY_HEAP_SIZE(size)     (TERM_BINARY_DATA_SIZE_IN_TERMS(size) + BINARY_HEADER_SIZE)
TERM_DEBUG_ASSERT(...)
TERM_FROM_ATOM_INDEX(atom_index) ((atom_index << 6) | 0xB)
REF_AS_CSTRING_LEN 33
PID_AS_CSTRING_LEN 17
TYPEDEF_GLOBALCONTEXT
TERM_MAP_NOT_FOUND -1
TERM_MAP_MEMORY_ALLOC_FAIL -2

Typedefs

typedef struct GlobalContext GlobalContext
typedef struct PrinterFun PrinterFun
typedef int (*printer_function_t)(PrinterFun *fun, const char *fmt, ...)

Enums

enum RefcBinaryFlags

Values:

enumerator RefcNoFlags = 0
enumerator RefcBinaryIsConst
enum TermCompareOpts

Values:

enumerator TermCompareNoOpts = 0
enumerator TermCompareExact = 1
enum TermCompareResult

Values:

enumerator TermCompareMemoryAllocFail = 0
enumerator TermEquals = 1
enumerator TermLessThan = 2
enumerator TermGreaterThan = 4

Functions

TermCompareResult term_compare(term t, term other, TermCompareOpts opts, GlobalContext *global)

Compares two terms.

Tells if first term is >, < or == to the second term.

Parameters:
  • t – the first term.

  • other – the second term.

  • opts – a value of 1 will compare exact equality, 0 for less strict equality.

  • global – the global context.

Returns:

any of TermEquals, TermLessThan, TermGreaterThan or TermCompareMemoryAllocFail error.

term term_alloc_refc_binary(size_t size, bool is_const, Heap *heap, GlobalContext *glb)

Create a reference-counted binary on the heap.

This function will create a reference-counted binary on the heap. If the data supplied is “const” (e.g., read from a literal in a BEAM file), then the returned term will point directly to the supplied data, and will not technically be reference-counted. Otherwise, a block of memory will be allocated to contain a copy of the data, in addition to a reference counter, so that the block can be free’d when no other terms reference the created object. (The reference count will be initialized to 1). If the data is non-NULL, it will be copied into the newly allocated block of memory.

Parameters:
  • size – the size (in bytes) of the data to allocate

  • is_const – designates whether the data pointed to is “const”, such as a term literal

  • heap – the heap to allocate the binary in

  • glb – the global context as refc binaries are global

Returns:

a term (reference) pointing to the newly allocated binary in the process heap.

term term_alloc_sub_binary(term binary, size_t offset, size_t len, Heap *heap)

Create a sub-binary.

This function will create a sub-binary on the heap, using the supplied binary, offset into the binary, and length of the sub-binary. This function assumes the length of the referenced binary is greater or equal to offset + len.

Parameters:
  • binary – the referenced binary

  • offset – the offset into the referenced binary to start the sub-binary

  • len – the length (in bytes) of the sub-binary

  • heap – the heap to allocate the binary in

Returns:

a term (reference) pointing to the newly allocated sub-binary in the process heap.

static inline term *term_to_term_ptr(term t)

Gets a pointer to a term stored on the heap.

Casts a term to a term * that points to a value stored on the heap. Be aware: terms are assumed to be immutable.

Parameters:
  • t – the term that will be casted, it must be valid.

Returns:

a pointer to a term.

static inline const term *term_to_const_term_ptr(term t)

Gets a const pointer to a term stored on the heap.

Casts a term to a const term * that points to a value stored on the heap.

Parameters:
  • t – the term that will be casted, it must be valid.

Returns:

a const pointer to a term.

static inline int term_is_atom(term t)

Checks if a term is an atom.

Returns 1 if a term is an atom, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_invalid_term(term t)

Check if a term is an invalid term.

Returns 1 if a term is an invalid term, otherwise 0 is returned.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_nil(term t)

Checks if a term is nil.

Returns 1 if a term is nil, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_nonempty_list(term t)

Checks if a term is a non empty list.

Returns 1 if a term is a non empty list (cons), otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_list(term t)

Checks if a term is a list.

Returns 1 if a term is a list (cons) or an empty list (nil term), otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_boxed(term t)

Checks if a term is a boxed value.

Returns 1 if a term is a boxed value stored on the heap, such as a tuple, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_movable_boxed(term t)

Checks if a term is a movable boxed value.

Returns 1 if a term is a boxed value that can be safely copied with memcpy.

Parameters:
  • t – the term that will checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline size_t term_get_size_from_boxed_header(term header)

Returns size of a boxed term from its header.

Returns the size that is stored in boxed term header most significant bits.

Parameters:
  • header – the boxed term header.

Returns:

the size of the boxed term that follows the header. 0 is returned if the boxed term is just the header.

static inline size_t term_boxed_size(term t)

Returns size of a boxed term.

Returns the size of a boxed term in term units.

Parameters:
  • t – the boxed term.

Returns:

size of given term.

static inline int term_is_binary(term t)

Checks if a term is a binary.

Returns 1 if a term is a binary stored on the heap, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline bool term_is_refc_binary(term t)

Checks if a term is a binary.

Returns 1 if a term is a binary stored on the heap, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline bool term_refc_binary_is_const(term t)
static inline bool term_is_sub_binary(term t)

Checks if a term is a sub-binary.

Returns true if a term is a sub-binary; false, otherwise.

Parameters:
  • t – the term that will be checked.

Returns:

true if check succeeds; false, otherwise.

static inline int term_is_integer(term t)

Checks if a term is an integer value.

Returns 1 if a term is an integer value, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline uint8_t term_is_uint8(term t)

Checks if a term is a uint8_t.

Returns 1 if a term is an integer value in the [0, 255] range, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_boxed_integer(term t)
static inline int term_is_any_integer(term t)
static inline int term_is_catch_label(term t)
static inline int term_is_pid(term t)

Checks if a term is a pid.

Returns 1 if a term is a process id, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_tuple(term t)

Checks if a term is a tuple.

Returns 1 if a term is a tuple, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_reference(term t)

Checks if a term is a reference.

Returns 1 if a term is a reference, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline int term_is_function(term t)

Checks if a term is a fun.

Returns 1 if a term is a fun, otherwise 0.

Deprecated:

renamed to term_is_fun.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline bool term_is_fun(term t)

Checks if a term is a fun.

Returns true if a term is a fun, otherwise false.

Parameters:
  • t – the term that will be checked.

Returns:

true if check succeeds, false otherwise.

static inline bool term_is_external_fun(term t)

Checks if a term is an external fun.

Returns true if a term is an external fun such as “fun m:f/a”, otherwise false.

Parameters:
  • t – the term that will be checked.

Returns:

true if check succeeds, false otherwise.

static inline int term_is_cp(term t)

Checks if a term is a saved CP.

Returns 1 if a term is a saved continuation pointer, otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline term term_invalid_term()

Gets invalid term.

Returns always an invalid term.

Returns:

invalid term.

static inline term term_nil()

Gets nil value.

Returns always the nil value.

Returns:

nil value term.

static inline int term_to_atom_index(term t)

Gets global atom table index.

Returns atom table index for given atom term.

Parameters:
  • t – the term that will be converted to atom table index. t must be a valid atom term.

Returns:

a global atom table index.

static inline term term_from_atom_index(int atom_index)

Term from global atom table index.

Returns a term from the given global atom table index.

Parameters:
  • atom_index – global atoms table index.

Returns:

a term that encapsulates the atom.

static inline uint8_t term_to_uint8(term t)

Term to uint8.

Returns an uint8 for a given term. No overflow check is executed.

Parameters:
  • t – the term that will be converted to uint8.

Returns:

an uint8_t value.

static inline int32_t term_to_int32(term t)

Term to int32.

Returns an int32 for a given term. No overflow check is executed.

Parameters:
  • t – the term that will be converted to int32, term type is checked.

Returns:

a int32 value.

static inline avm_int_t term_to_int(term t)
static inline int term_to_catch_label_and_module(term t, int *module_index)
static inline int32_t term_to_local_process_id(term t)

Gets process table index.

Returns local process table index for given atom term.

Parameters:
  • t – the term that will be converted to local process table index, term type is checked.

Returns:

a local process table index.

static inline term term_from_int4(int8_t value)

Term from int4.

Returns a term for a given 4 bits integer value.

Parameters:
  • value – the value that will be converted to a term.

Returns:

a term that encapsulates the integer value.

static inline term term_from_int11(int16_t value)

Term from int11.

Returns a term for a given 11 bits integer value.

Parameters:
  • value – the value that will be converted to a term.

Returns:

a term that encapsulates the integer value.

static inline term term_from_int32(int32_t value)

Term from int32.

Returns a term for a given 32 bits integer value.

Parameters:
  • value – the value that will be converted to a term.

Returns:

a term that encapsulates the integer value.

static inline term term_from_int64(int64_t value)
static inline term term_from_int(avm_int_t value)
static inline avm_int_t term_unbox_int(term boxed_int)
static inline avm_int64_t term_unbox_int64(term boxed_long)
static inline avm_int_t term_maybe_unbox_int(term maybe_boxed_int)
static inline avm_int64_t term_maybe_unbox_int64(term maybe_boxed_int)
static inline term term_make_boxed_int(avm_int_t value, Heap *heap)
static inline term term_make_boxed_int64(avm_int64_t large_int64, Heap *heap)
static inline term term_make_maybe_boxed_int64(avm_int64_t value, Heap *heap)
static inline size_t term_boxed_integer_size(avm_int64_t value)
static inline term term_from_catch_label(unsigned int module_index, unsigned int label)
static inline term term_from_local_process_id(uint32_t local_process_id)

Term from local process id.

Returns a term for a given local process table index.

Parameters:
  • local_process_id – the local process table index that will be converted to a term.

Returns:

a term that encapsulates a PID.

static inline bool term_binary_size_is_heap_binary(size_t size)

Determine whether a binary should be a heap binary or not.

Returns true if a binary of the specified size should be allocated in the process heap (as opposed to being a refc binary)

Parameters:
  • size – the intended binary size

Returns:

true if the binary should be allocated in the process heap; false, otherwise.

static inline size_t term_binary_data_size_in_terms(size_t size)

The count of terms needed to store the given amount of bytes.

Returns the count of terms needed to store the given size in bytes.

Parameters:
  • size – the size in bytes

Returns:

the count of terms

static inline size_t term_binary_heap_size(size_t size)

The size (in terms) of a binary of size-many bytes in the heap.

Returns the number of terms needed in the heap to store a binary of a given size (in bytes)

Parameters:
  • size – the size of the binary (in bytes)

Returns:

the size (in terms) of a binary of size-many bytes in the heap

static inline unsigned long term_binary_size(term t)

Gets binary size.

Returns binary size for a given binary term.

Parameters:
  • t – a term pointing to binary data. Fails if t is not a binary term.

Returns:

binary size in bytes.

static inline void *term_refc_binary_ptr(term refc_binary)

Get the pointer off heap refc binary.

Returns address

Returns:

offset (in words).

static inline const char *term_binary_data(term t)

Gets binary data.

Returns a pointer to stored binary data.

Parameters:
  • t – a term pointing to binary data. Fails if t is not a binary term.

Returns:

a const char * pointing to binary internal data.

static inline term term_create_uninitialized_binary(size_t size, Heap *heap, GlobalContext *glb)

Create an uninitialized binary.

Allocates a binary on the heap, and returns a term pointing to it. Note that the data in the binary is uninitialized and could contain any garbage. Make sure to initialize before use, if needed (e.g., via memset). The binary may be allocated as a refc if it is large enough.

Parameters:
  • size – size of binary data buffer.

  • heap – the heap to allocate the binary in

  • glb – the global context as refc binaries are global

Returns:

a term pointing to the boxed binary pointer.

static inline term term_from_literal_binary(const void *data, size_t size, Heap *heap, GlobalContext *glb)

Term from binary data.

Allocates a binary on the heap, and returns a term pointing to it.

Parameters:
  • data – binary data.

  • size – size of binary data buffer.

  • heap – the heap to allocate the binary in

  • glb – the global context as refc binaries are global

Returns:

a term pointing to the boxed binary pointer.

static inline size_t term_sub_binary_heap_size(term binary, size_t len)

Get the number of words in the heap to allocate for a sub-binary.

This function is used to compute the number of words needed on the heap to allocate for a sub-binary. This function is typically used in conjunction with term_maybe_create_sub_binary

Parameters:
  • binary – source binary

  • len – desired length of the sub-binary

Returns:

the number of words needed to allocate on the process heap for the desired sub-binary

static inline term term_maybe_create_sub_binary(term binary, size_t offset, size_t len, Heap *heap, GlobalContext *glb)

(Maybe) create a sub-binary &#8212; if not, create a heap binary.

Allocates a sub-binary if the source binary is reference-counted binary and if the length of the sub-binary is sufficiently large.

Parameters:
  • binary – source binary

  • offset – offset into the source binary marking the start of the sub-binary

  • len – desired length of the sub-binary

  • heap – the heap to allocate memory in

  • glb – the global context as refc binaries are global

Returns:

a term pointing to the boxed binary pointer.

static inline void term_set_refc_binary_data(term t, const void *data)
static inline term term_from_const_binary(const void *data, size_t size, Heap *heap, GlobalContext *glb)
static inline term term_create_empty_binary(size_t size, Heap *heap, GlobalContext *glb)

Create an empty binary. All bytes in the binary are initialized to 0x00.

Allocates a binary on the heap, and returns a term pointing to it.

Parameters:
  • size – size of binary data buffer.

  • heap – the heap to allocate memory in

  • glb – the global context as refc binaries are global

Returns:

a term pointing to the boxed binary pointer.

static inline int term_bs_insert_binary(term t, int offset, term src, int n)

Insert an binary into a binary (using bit syntax).

Insert the data from the input binary, starting at the bit position starting in offset.

Parameters:
  • t – a term pointing to binary data. Fails if t is not a binary term.

  • offset – the bitwise offset in t at which to start writing the integer value

  • src – binary source to insert binary data into.

  • n – the number of low-order bits from value to write.

Returns:

0 on success; non-zero value if: t is not a binary term n is greater than the number of bits in an integer there is insufficient capacity in the binary to write these bits In general, none of these conditions should apply, if this function is being called in the context of generated bit syntax instructions.

static inline term term_from_ref_ticks(uint64_t ref_ticks, Heap *heap)

Get a ref term from ref ticks.

Parameters:
  • ref_ticks – an unique uint64 value that will be used to create ref term.

  • heap – the heap to allocate memory in

Returns:

a ref term created using given ref ticks.

static inline uint64_t term_to_ref_ticks(term rt)
static inline term term_alloc_tuple(uint32_t size, Heap *heap)

Allocates a tuple on a context heap.

Allocates an uninitialized tuple on the heap with given arity.

Parameters:
  • size – tuple arity (count of tuple elements).

  • heap – the heap to allocate memory in

Returns:

a term pointing on an empty tuple allocated on the heap.

static inline void term_put_tuple_element(term t, uint32_t elem_index, term put_value)

Replaces the content of a tuple element.

Destructively replaces the nth element of an existing tuple, it should be used only on newly allocated tuples.

Parameters:
  • t – the term pointing to the target tuple, fails if not a tuple.

  • elem_index – the index of the element that will be replaced.

  • put_value – the term that will be put on the nth tuple element.

static inline term term_get_tuple_element(term t, int elem_index)

Returns the nth tuple element.

Returns the nth element for a given tuple pointed by a term.

Parameters:
  • t – a term that points to a tuple, fails otherwise.

  • elem_index – index of the nth element that will be returned.

Returns:

nth tuple term.

static inline int term_get_tuple_arity(term t)
static inline term term_from_string(const uint8_t *data, uint16_t size, Heap *heap)

Allocates a new list using string data.

Returns a term that points to a list (cons) that will be created using a string.

Parameters:
  • data – a pointer to a string, it doesn’t need to be NULL terminated.

  • size – of the string/list that will be read and allocated.

  • heap – the heap to allocate memory in

Returns:

a term pointing to a list.

static inline term *term_get_list_ptr(term t)

Gets a term * pointing to a list.

Returns a term * pointer to a list (cons) from a given term.

Parameters:
  • t – a term that points to a valid cons.

Returns:

a term * pointing to the head of the first cell of a list.

static inline term term_list_from_list_ptr(term *list_elem)

Gets list term from pointer.

Return given list term from a list element pointer.

Parameters:
  • list_elem – a pointer to a list element.

Returns:

a list term

static inline term term_get_list_head(term t)

Gets list head.

Returns given list head term

Parameters:
  • t – a term pointing to a valid list (cons)

Returns:

list head term

static inline term term_get_list_tail(term t)

Gets list item tail.

Returns the tail, which is either a pointer to the next list item or nil, of the given list (that is not list tail).

Returns:

list item tail term.

static inline term *term_list_alloc(Heap *heap)

Allocate uninitialized memory for a list item.

Allocates a memory area that will be used to store a list item.

Parameters:
  • heap – the heap to allocate memory in

Returns:

a pointer to a newly allocated memory area.

static inline term term_list_init_prepend(term *list_elem, term head, term tail)

Prepends a term to an existing list.

Initializes a list item, set head to the given term and points tail to the given next item (that might be nil).

Parameters:
  • head – term, the encapsulated list item value.

  • tail – either nil or next list item.

  • list_elem – the memory area that will be initialized.

Returns:

a term pointing to the newly initialized list item.

static inline term term_list_prepend(term head, term tail, Heap *heap)

Prepends a term to an existing list.

Allocates a new list item, set head to the given term and points tail to the given next item (that might be nil).

Parameters:
  • head – term, the encapsulated list item value.

  • tail – either nil or next list item.

  • heap – the heap to allocate memory in

Returns:

a term pointing to the newly created list item.

static inline int term_list_length(term t, int *proper)

Returns list length.

Counts the number of list items

Returns:

number of list items

static inline int term_is_float(term t)
static inline term term_from_float(avm_float_t f, Heap *heap)
static inline avm_float_t term_to_float(term t)
static inline avm_float_t term_conv_to_float(term t)
static inline int term_is_number(term t)
void term_display(FILE *fd, term t, const Context *ctx)

Prints a term to stdout.

Print any term to the given file.

Parameters:
  • fd – the file where the term will be printed.

  • t – the term that will be printed.

  • ctx – the context.

int term_funprint(PrinterFun *pf, term t, const GlobalContext *global)

Prints a term using given printer fun.

Print any given term using a printer fun

Parameters:
  • pf – function that will handle printing.

  • t – the term that will be printed.

  • global – the GlobalContext.

Returns:

the number of printed characters.

int term_fprint(FILE *fd, term t, const GlobalContext *global)

Prints a term to the given file.

Print any given term to the given file.

Parameters:
  • fd – the file where the term will be printed.

  • t – the term that will be printed.

  • global – the GlobalContext.

Returns:

the number of printed characters.

int term_snprint(char *buf, size_t size, term t, const GlobalContext *global)

Write a term to a string as text.

Print any given term to the given buffer.

Parameters:
  • buf – the buffer where the term will be printed.

  • size – the buffer size.

  • t – the term that will be printed.

  • global – the GlobalContext.

Returns:

the number of printed characters.

static inline int term_is_string(term t)

Checks if a term is a string (i.e., a list of characters)

Returns 1 if a term is a proper (nil-terminated) list of characters or an empty list (nil term), otherwise 0.

Parameters:
  • t – the term that will be checked.

Returns:

1 if check succeeds, 0 otherwise.

static inline term term_make_function_reference(term m, term f, term a, Heap *heap)
static inline int term_is_match_state(term t)
static inline term term_get_match_state_binary(term match_state)
static inline avm_int_t term_get_match_state_offset(term match_state)
static inline void term_set_match_state_offset(term match_state, avm_int_t offset)
static inline void term_match_state_save_offset(term match_state, int index)
static inline void term_match_state_save_start_offset(term match_state)
static inline void term_match_state_restore_start_offset(term match_state)
static inline void term_match_state_restore_offset(term match_state, int index)
static inline term term_alloc_bin_match_state(term binary_or_state, int slots, Heap *heap)
static inline void term_truncate_boxed(term boxed, size_t new_size, Heap *heap)

truncates last allocated boxed term to given size

This function can be used to shrink last allocated boxed term

Parameters:
  • boxed – the boxed term that will be shrinked (it must be the last allocated)

  • new_size – in terms

  • heap – the heap where the term has been allocated

static inline int term_is_map(term t)
static inline size_t term_get_map_keys_offset()
static inline size_t term_get_map_value_offset()
static inline size_t term_map_size_in_terms_maybe_shared(size_t num_entries, bool is_shared)
static inline size_t term_map_size_in_terms(size_t num_entries)
static inline term term_alloc_map_maybe_shared(avm_uint_t size, term keys, Heap *heap)
static inline term term_alloc_map(avm_uint_t size, Heap *heap)
static inline term term_get_map_keys(term t)
static inline int term_get_map_size(term t)
static inline void term_set_map_assoc(term map, avm_uint_t pos, term key, term value)
static inline term term_get_map_key(term map, avm_uint_t pos)
static inline term term_get_map_value(term map, avm_uint_t pos)
static inline void term_set_map_value(term map, avm_uint_t pos, term value)
static inline int term_find_map_pos(term map, term key, GlobalContext *global)
term term_get_map_assoc(term map, term key, GlobalContext *glb)
static inline term term_get_map_assoc_default(term map, term key, term default_value, GlobalContext *glb)
static inline term term_get_sub_binary_ref(term t)
static inline term term_from_resource(void *resource, Heap *heap)

Create a resource on the heap.

This function creates a resource (obtained from enif_alloc_resource) on the heap which must have TERM_BOXED_RESOURCE_SIZE free terms.

Unlike enif_make_resource, this function doesn’t increment the reference counter but instead makes the heap own the resource. It will be garbage collected when the heap is destroyed.

Parameters:
  • resource – resource obtained from enif_alloc_resource

  • heap – the heap to allocate the resource in

Returns:

a term pointing to the resource

Variables

const term empty_tuple

All empty tuples will reference this.

struct PrinterFun
#include <term.h>

Collaboration diagram for PrinterFun:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="PrinterFun" tooltip="PrinterFun" fillcolor="#BFBFBF"]
    "1" -> "1" [dir=forward tooltip="usage"]
}

Public Members

printer_function_t print