<commit_before>/**
 * @file lists.h
 * @brief List management system definition.
 */

#ifndef LISTS_H
#define LISTS_H


/////////////////////
// LIST STRUCTURES //
/////////////////////

/**
 * @brief Generic list item.
 */
typedef struct l_obj {
    TCB             *pTask;     /**< Pointer to the task function. */
    uint            nTCnt;      /**< Tick counter. */
    msg             *pMessage;
    struct l_obj    *pPrevious; /**< Pointer to previous object in list. */
    struct l_obj    *pNext;     /**< Pointer to next object in list. */
} listobj;

/**
 * @brief Generic list.
 */
typedef struct {
    listobj         *pHead;     /**< Pointer to the head of the list. */
    listobj         *pTail;     /**< Pointer to the tail of the list. */
} list;


///////////////////////////////
// FUNCTIONS TO MANAGE LISTS //
///////////////////////////////

/**
 * @brief Insert a new element in the readyList.
 * 
 * The list is sorted from the lowest deadline values first.
 * 
 * @param elmt Pointer to the element to be inserted.
 */
void insert_readyList(listobj* elmt);

/**
 * @brief Extract an element from the readyList.
 *
 * The first element of the list (lowest deadline) is extracted.
 * 
 * @return Pointer to the extracted element.
 */
listobj* extract_readyList(void);

/**
 * @brief Insert a new element in the timerList.
 *
 * The list is sorted from the lowest number of ticks values first.
 * 
 * @param elmt  Pointer to the element to be inserted.
 * @param nTCnt Number of ticks to wait.
 */
void insert_timerList(listobj* elmt, uint nTCnt);

/**
 * @brief Extract an element from the timerList.
 *
 * The first element of the list (lowest tick counter) is extracted.
 * 
 * @return  Pointer to the extracted element.
 */
listobj* extract_timerList(void);

/**
 * @brief Insert a new element in the waitingList.
 *
 * The list is sorted from the lowest deadline values first.
 * 
 * @param elmt Pointer to the element to be inserted.
 */
void insert_waitingList(listobj* elmt);

/**
 * @brief Extract an element from the waitingList.
 *
 * The element corresponding to the parameter is extracted.
 * 
 * @param  elmt Pointer to the element to be extracted.
 * @return      Pointer to the extracted element.
 */
listobj* extract_waitingList(listobj* elmt);

#endif<commit_msg>Add exceptions handling in lists.h<commit_after>/**
 * @file lists.h
 * @brief List management system definition.
 */

#ifndef LISTS_H
#define LISTS_H


/////////////////////
// LIST STRUCTURES //
/////////////////////

/**
 * @brief Generic list item.
 */
typedef struct l_obj {
    TCB             *pTask;     /**< Pointer to the task function. */
    uint            nTCnt;      /**< Tick counter. */
    msg             *pMessage;
    struct l_obj    *pPrevious; /**< Pointer to previous object in list. */
    struct l_obj    *pNext;     /**< Pointer to next object in list. */
} listobj;

/**
 * @brief Generic list.
 */
typedef struct {
    listobj         *pHead;     /**< Pointer to the head of the list. */
    listobj         *pTail;     /**< Pointer to the tail of the list. */
} list;


///////////////////////////////
// FUNCTIONS TO MANAGE LISTS //
///////////////////////////////

/**
 * @brief Insert a new element in the readyList.
 * 
 * The list is sorted from the lowest deadline values first.
 * 
 * @param elmt Pointer to the element to be inserted.
 * @return     OK if success, FAIL otherwise.
 */
exception insert_readyList(listobj* elmt);

/**
 * @brief Extract an element from the readyList.
 *
 * The first element of the list (lowest deadline) is extracted.
 * 
 * @return Pointer to the extracted element or null.
 */
listobj* extract_readyList(void);

/**
 * @brief Insert a new element in the timerList.
 *
 * The list is sorted from the lowest number of ticks values first.
 * 
 * @param elmt  Pointer to the element to be inserted.
 * @param nTCnt Number of ticks to wait.
 * @return      OK if success, FAIL otherwise.
 */
exception insert_timerList(listobj* elmt, uint nTCnt);

/**
 * @brief Extract an element from the timerList.
 *
 * The first element of the list (lowest tick counter) is extracted.
 * 
 * @return  Pointer to the extracted element or null.
 */
listobj* extract_timerList(void);

/**
 * @brief Insert a new element in the waitingList.
 *
 * The list is sorted from the lowest deadline values first.
 * 
 * @param elmt Pointer to the element to be inserted.
 * @return     OK if success, FAIL otherwise.
 */
exception insert_waitingList(listobj* elmt);

/**
 * @brief Extract an element from the waitingList.
 *
 * The element corresponding to the parameter is extracted.
 * 
 * @param  elmt Pointer to the element to be extracted.
 * @return      Pointer to the extracted element or null.
 */
listobj* extract_waitingList(listobj* elmt);

#endif
{'fraction_non_alphanumeric': 0.140894901144641, 'fraction_numerical': 0.0, 'mean_word_length': 2.332871012482663, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3323553', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1346, 'n_words': 561}