diff --git a/Developer-documentation.md b/Developer-documentation.md index ff0b6f8..78044d9 100644 --- a/Developer-documentation.md +++ b/Developer-documentation.md @@ -28,6 +28,19 @@ Each error type must have a status code that is unique in the whole program. The - First 4 bits: identifies a certain module of the previewer - Last 4 bits: identifies the exact problem +## Memory allocation + +The module provides its own memory allocation library called **MagicMemory**. The library can be used to create MagicMemory contexts. All memory allocation calls must be performed through this library. If a function allocates memory, it has to take a MagicMemory context (that has the type `mm_ctx`) as its first parameter and perform the memory allocation inside that context. Before the program exits, all of the contexts must be freed up. + +## Data validation + +There are two different kinds of functions that perform data validation: + +- **Validator**: A validator only validates data according to its format specification. +- **Parser**: A parser validates data and then extracts some fields from the data. + +It is not unusual for a parser function to call a validator function to validate its whole input before extracting the fields. + # CAFF previewer wrapper This module makes communication between the previewer and the web client possible.