Back to Atomvm

MACROS

main-apidocs-libatomvm-macros.md

latest1.1 KB
Original Source

MACROS

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.

GET_LIST_ENTRY(list_item, type, list_head_member)((type *) (((char *) (list_item)) - ((unsigned long) &((type *) 0)->list_head_member)))

gets a pointer to the struct that contains a certain list head

This macro should be used to retrieve a pointer to the struct that is containing the given ListHead.

SELECT_INT_DEFAULT(i_val)

{\

.as_val = NULL, i_val\

}

An idiomatic macro for marking an AtomStringIntPair table entry as a interop_atom_term_select_int default.