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="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom.h" tooltip="/home/runner/work/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"]
    "13" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.c"]
    "47" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/dictionary.c"]
    "12" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/bif.h"]
    "33" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom.c"]
    "21" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.c"]
    "1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom.h" fillcolor="#BFBFBF"]
    "48" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "46" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/defaultatoms.h"]
    "27" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "26" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/inet.h"]
    "44" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "10" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.c"]
    "11" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/context.h"]
    "42" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "43" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom_table.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom_table.c"]
    "4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom_table.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atom_table.h"]
    "35" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "34" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/stacktrace.h"]
    "22" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/refc_binary.c"]
    "45" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "14" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.c"]
    "32" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "8" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
    "7" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h"]
    "31" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "29" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.c"]
    "20" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.c"]
    "25" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/interop.h"]
    "41" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_ssl.h"]
    "23" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/resources.c"]
    "30" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "38" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_crypto.h"]
    "28" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "39" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_net.h"]
    "18" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/erl_nif_priv.h"]
    "36" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/sys.h"]
    "50" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atomshashtable.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atomshashtable.c"]
    "49" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atomshashtable.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/atomshashtable.h"]
    "9" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
    "37" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "16" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.c"]
    "15" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/debug.h"]
    "5" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
    "6" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.h"]
    "17" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/memory.c"]
    "19" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.c"]
    "40" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "24" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/externalterm.c"]
    "12" -> "13" [dir=back tooltip="include"]
    "12" -> "14" [dir=back tooltip="include"]
    "12" -> "9" [dir=back tooltip="include"]
    "33" -> "9" [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"]
    "48" -> "5" [dir=back tooltip="include"]
    "48" -> "9" [dir=back tooltip="include"]
    "48" -> "19" [dir=back tooltip="include"]
    "48" -> "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"]
    "26" -> "27" [dir=back tooltip="include"]
    "26" -> "28" [dir=back tooltip="include"]
    "26" -> "19" [dir=back tooltip="include"]
    "26" -> "20" [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"]
    "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"]
    "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"]
    "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"]
    "34" -> "35" [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"]
    "7" -> "8" [dir=back tooltip="include"]
    "7" -> "5" [dir=back tooltip="include"]
    "7" -> "9" [dir=back tooltip="include"]
    "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"]
    "41" -> "20" [dir=back tooltip="include"]
    "38" -> "30" [dir=back tooltip="include"]
    "39" -> "28" [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"]
    "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"]
    "49" -> "50" [dir=back tooltip="include"]
    "49" -> "5" [dir=back tooltip="include"]
    "49" -> "32" [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"]
    "15" -> "16" [dir=back tooltip="include"]
    "15" -> "17" [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"]
    "40" -> "19" [dir=back tooltip="include"]
    "40" -> "20" [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