atom.h

Include dependency graph for atom.h:

digraph {
    graph [bgcolor="#00000000"]
    node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
    edge [color="#1414CE"]
    "1" [label="/__w/AtomVM/AtomVM/src/libAtomVM/atom.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/atom.h" fillcolor="#BFBFBF"]
    "2" [label="stdint.h" tooltip="stdint.h"]
    "3" [label="stdlib.h" tooltip="stdlib.h"]
    "1" -> "2" [dir=forward tooltip="include"]
    "1" -> "3" [dir=forward tooltip="include"]
}

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

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

Atoms manipulation functions.

This header provides atom manipulation functions, such as atom_string_len, atom_string_data, etc…

Defines

ATOM_STR(LENSTR, STR) (LENSTR STR)

no-op macro: just syntax sugar for avoiding mistakes or clang-format dividing atoms in multiple lines. Usage: ATOM_STR(”\x5”, “hello”).

Parameters:
  • LENSTR – must be less than 255 (\xFF), to fit within a uint8.

  • STR – the string to be used as an atom.

Typedefs

typedef const void *AtomString

Functions

void atom_string_to_c(AtomString atom_string, char *buf, size_t bufsize)

Gets a C string from an AtomString.

Copies the atom string data to a buffer and makes it null terminated.

Parameters:
  • atom_string – that will be converted to a C string.

  • buf – the buffer where the C string will be written.

  • bufsize – available buf size.

int atom_are_equals(AtomString a, AtomString b)

Check for equality two AtomStrings.

Returns 1 if two atom strings are equal, 0 otherwise. This function doesn’t behave like strcmp.

Parameters:
  • a – first atom string to be compared.

  • b – second atom string to be compared.

Returns:

1 if they are equals, 0 otherwise.

static inline size_t atom_string_len(AtomString atom_str)

Returns the length of an atom string in bytes.

Returns the length stored in the AtomString (which means that length is not computed).

Parameters:
  • atom_str – the atom string.

Returns:

the specified atom string length.

static inline const void *atom_string_data(AtomString atom_str)

Gets actual atom string data.

Returns actual atom string data, which is not a \0 terminated C string.

Parameters:
  • atom_str – an AtomString pointer.

Returns:

const pointer to string data (chars array).

void atom_write_mfa(char *buf, size_t buf_size, AtomString module, AtomString function, unsigned int arity)

Write module:function/arity to the supplied buffer.

Write module:function/arity to the supplied buffer. This function will abort if the written module, function, and arity are longer than the supplied buffer size.

Parameters:
  • buf – the buffer to write into

  • buf_size – the amount of room in the buffer

  • module – the module name

  • function – the function name

  • arity – the function arity