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

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