Skip to content
Snippets Groups Projects
Commit bb429d1f authored by Kostyantyn Vorobyov's avatar Kostyantyn Vorobyov
Browse files

[Bittree RTL] Doxygen comments

parent 37029c25
No related branches found
No related tags found
No related merge requests found
...@@ -31,41 +31,40 @@ ...@@ -31,41 +31,40 @@
#include "stdlib.h" #include "stdlib.h"
#include "stdbool.h" #include "stdbool.h"
/* Memory block allocated and may be deallocated */ /*! \brief Structure representing an allocated memory block */
struct _block { struct _block {
size_t ptr; /* base address */ size_t ptr; //!< Base address
size_t size; /* block length */ size_t size; //!< Block length (in bytes)
/* Keep trace of initialized sub-blocks within a memory block */ unsigned char * init_ptr; //!< Per-bit initialization
unsigned char * init_ptr; /* dynamic array of booleans */ size_t init_cpt; //!< Number of initialized bytes
size_t init_cpt; _Bool is_readonly; //!< True if a block is marked read-only
_Bool is_readonly; _Bool freeable; //!< True if a block can be de-allocated using `free`
_Bool freeable;
}; };
/* remove the block from the structure */ /*! \brief Remove a block from the structure */
static void remove_element(struct _block *); static void remove_element(struct _block *b);
/* add a block in the structure */ /*! \brief Add a block to the structure */
static void add_element(struct _block *); static void add_element(struct _block *b);
/* return the block B such as : begin addr of B == ptr /*! \brief Return block B such that: `\base_addr(B->ptr) == ptr`.
we suppose that such a block exists, but we could return NULL if not */ NB: The function assumes that such a block exists. */
static struct _block * get_exact(void *); static struct _block * get_exact(void *ptr);
/* return the block B containing ptr, such as : /*! \brief Return block B such that:
begin addr of B <= ptr < (begin addr + size) of B `\base_addr(B->ptr) <= ptr < (\base_addr(B->ptr) + size)`
or NULL if such a block does not exist */ or NULL if such a block does not exist. */
static struct _block * get_cont(void *); static struct _block * get_cont(void *ptr);
/* erase the content of the structure */ /*! \brief Erase the contents of the structure */
static void clean_struct(void); static void clean_struct(void);
/* print the information about a block */ /*! \brief Print information about a given block */
static void print_block(struct _block * ptr ); static void print_block(struct _block *b);
/* erase information about initialization of a block */ /*! \brief Erase information about a block's initialization */
static void clean_init(struct _block * ptr ); static void clean_init(struct _block *b);
/* erase all information about a block */ /*! \brief Erase all information about a given block */
static void clean_block(struct _block * ptr); static void clean_block(struct _block *b);
#endif #endif
...@@ -368,7 +368,7 @@ void* __base_addr(void* ptr) { ...@@ -368,7 +368,7 @@ void* __base_addr(void* ptr) {
return (void*)tmp->ptr; return (void*)tmp->ptr;
} }
/* return the offset of ptr within its block */ /* return the offset of `ptr` within its block */
int __offset(void* ptr) { int __offset(void* ptr) {
struct _block * tmp = get_cont(ptr); struct _block * tmp = get_cont(ptr);
vassert(tmp != NULL, "\\offset of unallocated memory", NULL); vassert(tmp != NULL, "\\offset of unallocated memory", NULL);
...@@ -384,7 +384,7 @@ void __e_acsl_memory_clean() { ...@@ -384,7 +384,7 @@ void __e_acsl_memory_clean() {
clean_struct(); clean_struct();
} }
/* adds argv to the memory model */ /* add `argv` to the memory model */
static void __init_argv(int argc, char **argv) { static void __init_argv(int argc, char **argv) {
int i; int i;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment