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"]
    "30" [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"]
    "26" [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"]
    "38" [label="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/nifs.h"]
    "49" [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"]
    "50" [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"]
    "52" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.c"]
    "31" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_crypto.c"]
    "51" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets_hashtable.h"]
    "44" [label="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.c"]
    "39" [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"]
    "43" [label="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/portnifloader.h"]
    "37" [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"]
    "33" [label="/__w/AtomVM/AtomVM/src/libAtomVM/module.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/module.h"]
    "29" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_net.c"]
    "40" [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"]
    "28" [label="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/inet.c"]
    "32" [label="/__w/AtomVM/AtomVM/src/libAtomVM/term.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/term.c"]
    "27" [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"]
    "25" [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"]
    "34" [label="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/platform_nifs.h"]
    "47" [label="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/scheduler.h"]
    "55" [label="/__w/AtomVM/AtomVM/src/libAtomVM/atomshashtable.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/atomshashtable.c"]
    "54" [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"]
    "41" [label="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/otp_socket.h"]
    "36" [label="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/stacktrace.c"]
    "35" [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"]
    "42" [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"]
    "53" [label="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/posix_nifs.h"]
    "48" [label="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/mailbox.c"]
    "45" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.c"]
    "46" [label="/__w/AtomVM/AtomVM/src/libAtomVM/port.h" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/port.h"]
    "24" [label="/__w/AtomVM/AtomVM/src/libAtomVM/ets.c" tooltip="/__w/AtomVM/AtomVM/src/libAtomVM/ets.c"]
    "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" -> "19" [dir=back tooltip="include"]
    "26" -> "20" [dir=back tooltip="include"]
    "26" -> "21" [dir=back tooltip="include"]
    "26" -> "32" [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"]
    "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" -> "19" [dir=back tooltip="include"]
    "38" -> "41" [dir=back tooltip="include"]
    "38" -> "20" [dir=back tooltip="include"]
    "38" -> "42" [dir=back tooltip="include"]
    "38" -> "43" [dir=back tooltip="include"]
    "38" -> "21" [dir=back tooltip="include"]
    "49" -> "13" [dir=back tooltip="include"]
    "49" -> "50" [dir=back tooltip="include"]
    "49" -> "24" [dir=back tooltip="include"]
    "49" -> "5" [dir=back tooltip="include"]
    "49" -> "30" [dir=back tooltip="include"]
    "49" -> "9" [dir=back tooltip="include"]
    "49" -> "31" [dir=back tooltip="include"]
    "49" -> "29" [dir=back tooltip="include"]
    "49" -> "19" [dir=back tooltip="include"]
    "49" -> "20" [dir=back tooltip="include"]
    "49" -> "45" [dir=back tooltip="include"]
    "49" -> "46" [dir=back tooltip="include"]
    "49" -> "21" [dir=back tooltip="include"]
    "49" -> "23" [dir=back tooltip="include"]
    "49" -> "36" [dir=back tooltip="include"]
    "1" -> "2" [dir=back tooltip="include"]
    "1" -> "3" [dir=back tooltip="include"]
    "1" -> "4" [dir=back tooltip="include"]
    "1" -> "54" [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"]
    "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" -> "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" -> "19" [dir=back tooltip="include"]
    "11" -> "20" [dir=back tooltip="include"]
    "11" -> "45" [dir=back tooltip="include"]
    "11" -> "46" [dir=back tooltip="include"]
    "11" -> "43" [dir=back tooltip="include"]
    "11" -> "22" [dir=back tooltip="include"]
    "11" -> "23" [dir=back tooltip="include"]
    "11" -> "47" [dir=back tooltip="include"]
    "11" -> "35" [dir=back tooltip="include"]
    "11" -> "32" [dir=back tooltip="include"]
    "12" -> "13" [dir=back tooltip="include"]
    "12" -> "14" [dir=back tooltip="include"]
    "12" -> "9" [dir=back tooltip="include"]
    "51" -> "24" [dir=back tooltip="include"]
    "51" -> "52" [dir=back tooltip="include"]
    "39" -> "31" [dir=back tooltip="include"]
    "43" -> "44" [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" -> "19" [dir=back tooltip="include"]
    "37" -> "23" [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"]
    "33" -> "32" [dir=back tooltip="include"]
    "40" -> "29" [dir=back tooltip="include"]
    "27" -> "28" [dir=back tooltip="include"]
    "27" -> "29" [dir=back tooltip="include"]
    "27" -> "19" [dir=back tooltip="include"]
    "27" -> "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" -> "30" [dir=back tooltip="include"]
    "4" -> "33" [dir=back tooltip="include"]
    "4" -> "9" [dir=back tooltip="include"]
    "4" -> "32" [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" -> "49" [dir=back tooltip="include"]
    "6" -> "51" [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" -> "19" [dir=back tooltip="include"]
    "6" -> "41" [dir=back tooltip="include"]
    "6" -> "20" [dir=back tooltip="include"]
    "6" -> "42" [dir=back tooltip="include"]
    "6" -> "45" [dir=back tooltip="include"]
    "6" -> "46" [dir=back tooltip="include"]
    "6" -> "43" [dir=back tooltip="include"]
    "6" -> "21" [dir=back tooltip="include"]
    "6" -> "53" [dir=back tooltip="include"]
    "6" -> "47" [dir=back tooltip="include"]
    "6" -> "36" [dir=back tooltip="include"]
    "6" -> "37" [dir=back tooltip="include"]
    "34" -> "9" [dir=back tooltip="include"]
    "47" -> "5" [dir=back tooltip="include"]
    "47" -> "48" [dir=back tooltip="include"]
    "47" -> "9" [dir=back tooltip="include"]
    "47" -> "19" [dir=back tooltip="include"]
    "54" -> "55" [dir=back tooltip="include"]
    "54" -> "5" [dir=back tooltip="include"]
    "54" -> "33" [dir=back tooltip="include"]
    "41" -> "19" [dir=back tooltip="include"]
    "41" -> "20" [dir=back tooltip="include"]
    "35" -> "36" [dir=back tooltip="include"]
    "42" -> "20" [dir=back tooltip="include"]
    "53" -> "5" [dir=back tooltip="include"]
    "53" -> "9" [dir=back tooltip="include"]
    "53" -> "19" [dir=back tooltip="include"]
    "53" -> "21" [dir=back tooltip="include"]
    "46" -> "28" [dir=back tooltip="include"]
    "46" -> "9" [dir=back tooltip="include"]
    "46" -> "29" [dir=back tooltip="include"]
    "46" -> "19" [dir=back tooltip="include"]
    "46" -> "20" [dir=back tooltip="include"]
    "46" -> "45" [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