avmpack.h
Include dependency graph for avmpack.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"7" [label="stdbool.h" tooltip="stdbool.h"]
"4" [label="atom.h" tooltip="atom.h"]
"10" [label="assert.h" tooltip="assert.h"]
"18" [label="synclist.h" tooltip="synclist.h"]
"3" [label="stdint.h" tooltip="stdint.h"]
"5" [label="stdlib.h" tooltip="stdlib.h"]
"15" [label="utils.h" tooltip="utils.h"]
"6" [label="atom_table.h" tooltip="atom_table.h"]
"9" [label="term_typedef.h" tooltip="term_typedef.h"]
"16" [label="stddef.h" tooltip="stddef.h"]
"11" [label="limits.h" tooltip="limits.h"]
"23" [label="refc_binary.h" tooltip="refc_binary.h"]
"21" [label="string.h" tooltip="string.h"]
"14" [label="mailbox.h" tooltip="mailbox.h"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" fillcolor="#BFBFBF"]
"20" [label="term.h" tooltip="term.h"]
"8" [label="erl_nif.h" tooltip="erl_nif.h"]
"24" [label="resources.h" tooltip="resources.h"]
"17" [label="smp.h" tooltip="smp.h"]
"2" [label="globalcontext.h" tooltip="globalcontext.h"]
"22" [label="memory.h" tooltip="memory.h"]
"19" [label="stdio.h" tooltip="stdio.h"]
"25" [label="timer_list.h" tooltip="timer_list.h"]
"13" [label="list.h" tooltip="list.h"]
"12" [label="inttypes.h" tooltip="inttypes.h"]
"4" -> "3" [dir=forward tooltip="include"]
"4" -> "5" [dir=forward tooltip="include"]
"18" -> "13" [dir=forward tooltip="include"]
"18" -> "19" [dir=forward tooltip="include"]
"18" -> "17" [dir=forward tooltip="include"]
"15" -> "16" [dir=forward tooltip="include"]
"6" -> "7" [dir=forward tooltip="include"]
"6" -> "4" [dir=forward tooltip="include"]
"9" -> "10" [dir=forward tooltip="include"]
"9" -> "11" [dir=forward tooltip="include"]
"9" -> "12" [dir=forward tooltip="include"]
"9" -> "3" [dir=forward tooltip="include"]
"23" -> "7" [dir=forward tooltip="include"]
"23" -> "5" [dir=forward tooltip="include"]
"23" -> "13" [dir=forward tooltip="include"]
"23" -> "24" [dir=forward tooltip="include"]
"14" -> "7" [dir=forward tooltip="include"]
"14" -> "13" [dir=forward tooltip="include"]
"14" -> "9" [dir=forward tooltip="include"]
"14" -> "15" [dir=forward tooltip="include"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "13" [dir=forward tooltip="include"]
"1" -> "7" [dir=forward tooltip="include"]
"1" -> "16" [dir=forward tooltip="include"]
"1" -> "3" [dir=forward tooltip="include"]
"20" -> "7" [dir=forward tooltip="include"]
"20" -> "3" [dir=forward tooltip="include"]
"20" -> "19" [dir=forward tooltip="include"]
"20" -> "5" [dir=forward tooltip="include"]
"20" -> "21" [dir=forward tooltip="include"]
"20" -> "22" [dir=forward tooltip="include"]
"20" -> "23" [dir=forward tooltip="include"]
"20" -> "15" [dir=forward tooltip="include"]
"20" -> "9" [dir=forward tooltip="include"]
"8" -> "9" [dir=forward tooltip="include"]
"24" -> "5" [dir=forward tooltip="include"]
"24" -> "8" [dir=forward tooltip="include"]
"24" -> "13" [dir=forward tooltip="include"]
"24" -> "22" [dir=forward tooltip="include"]
"17" -> "7" [dir=forward tooltip="include"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "4" [dir=forward tooltip="include"]
"2" -> "6" [dir=forward tooltip="include"]
"2" -> "8" [dir=forward tooltip="include"]
"2" -> "13" [dir=forward tooltip="include"]
"2" -> "14" [dir=forward tooltip="include"]
"2" -> "17" [dir=forward tooltip="include"]
"2" -> "18" [dir=forward tooltip="include"]
"2" -> "20" [dir=forward tooltip="include"]
"2" -> "25" [dir=forward tooltip="include"]
"22" -> "8" [dir=forward tooltip="include"]
"22" -> "9" [dir=forward tooltip="include"]
"22" -> "15" [dir=forward tooltip="include"]
"22" -> "3" [dir=forward tooltip="include"]
"22" -> "5" [dir=forward tooltip="include"]
"25" -> "7" [dir=forward tooltip="include"]
"25" -> "3" [dir=forward tooltip="include"]
"25" -> "13" [dir=forward tooltip="include"]
}](../../../_images/graphviz-7982c9a688df33617c89a65cc9190e3421e21f8b.png)
This graph shows which files directly or indirectly include avmpack.h:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"2" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.c"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/avmpack.h" fillcolor="#BFBFBF"]
"4" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/nifs.c"]
"3" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/globalcontext.c"]
"1" -> "2" [dir=back tooltip="include"]
"1" -> "3" [dir=back tooltip="include"]
"1" -> "4" [dir=back tooltip="include"]
}](../../../_images/graphviz-f4ed7b7012b533cf5d893401717f637f580d4e8c.png)
AVM Pack file format parsing function.
Typedefs
-
typedef void *(*avmpack_fold_fun)(void *accum, const void *section_ptr, uint32_t section_size, const void *beam_ptr, uint32_t flags, const char *section_name)
callback function for AVMPack section fold.
Instances of this function are supplied to the avmpack_fold function, in order to provide a callback mechanism for folding over the contents of the AVM binary.
- Param accum:
The accumulator supplied by the application.
- Param section_ptr:
a pointer to the start of the AVM section (including the module header).
- Param section_size:
the size of the entire section (including the module header).
- Param beam_ptr:
the start of the beam module portion of the section. This pointers starts immediately after the (aligned) header.
- Param flags:
the section flags, as defined in the module header.
- Param section_name:
the section name, as defined in the module header.
- Return:
an accumulator, which will be supplied to the next call to this function, and eventually returned from the avmpack_fold function.
Functions
-
static inline void avmpack_data_init(struct AVMPackData *avm_pack_data, const struct AVMPackInfo *info)
-
static inline void avmpack_data_destroy(struct AVMPackData *avm_pack_data, GlobalContext *global)
-
int avmpack_find_section_by_flag(const void *avmpack_binary, uint32_t flags_mask, const void **ptr, uint32_t *size, const char **name)
Finds an AVM Pack section that has certain flags set.
Finds an AVM Pack section that has certain flags set and returns a pointer to it, its size and its name.
- Parameters:
avmpack_binary – a pointer to valid AVM Pack file data.
flags_mask – that will be matched against file sections.
ptr – will point to the found file section.
size – will be set to the file section size that has been found, if the section has not been found it will not be updated.
name – the section name, as defined in the module header.
- Returns:
1 if the file section has been found, 0 otherwise.
-
int avmpack_find_section_by_name(const void *avmpack_binary, const char *name, const void **ptr, uint32_t *size)
Finds an AVM Pack section that has certain name.
Finds an AVM Pack section with a certain name and returns a pointer to it and its size.
- Parameters:
avmpack_binary – a pointer to valid AVM Pack file data.
name – the file section name that will be searched.
ptr – will point to the found file section, if the section has not been found it will not be updated.
size – will be set to the file section size that has been found, if the section has not been found it will not be updated.
- Returns:
1 if the file section has been found, 0 otherwise.
-
int avmpack_is_valid(const void *avmpack_binary, uint32_t size)
Returns 1 if the pointed binary is a valid AVM Pack.
Returns if the pointed binary is a valid AVM Pack binary or not.
- Parameters:
avmpack_binary – a pointer to an AVM Pack binary.
size – the size of AVM Pack binary.
- Returns:
1 if it is a valid AVM Pack binary, 0 otherwise.
-
void *avmpack_fold(void *accum, const void *avmpack_binary, avmpack_fold_fun fold_fun)
Fold over all the sections in an AVM Pack.
This function will call the callback on each section of the AVM Pack, passing in the current section of each module in the AVM binary to the supplied fold function.
- Parameters:
accum – The accumulator supplied by the application.
avmpack_binary – a pointer to an AVM Pack binary.
fold_fun – function that will be called for each AVM section.
Variables
-
const struct AVMPackInfo in_memory_avm_pack_info
-
const struct AVMPackInfo const_avm_pack_info
-
struct AVMPackInfo
- #include <avmpack.h>
Public Members
-
void (*destructor)(struct AVMPackData *obj, GlobalContext *global)
-
void (*destructor)(struct AVMPackData *obj, GlobalContext *global)
-
struct AVMPackData
- #include <avmpack.h>
Collaboration diagram for AVMPackData:
-
struct InMemoryAVMPack
- #include <avmpack.h>
Collaboration diagram for InMemoryAVMPack:
Public Members
-
struct AVMPackData base
-
struct AVMPackData base
-
struct ConstAVMPack
- #include <avmpack.h>
Collaboration diagram for ConstAVMPack:
Public Members
-
struct AVMPackData base
-
struct AVMPackData base