// ========================================= // | SilverMUD Server - lists.h | // | Copyright (C) 2023, Barra Ó Catháin | // | See end of file for copyright notice. | // ========================================= #ifndef LISTS_H #define LISTS_H #include "data-type.h" #include struct List { size_t itemCount; enum DataType type; struct ListNode * head; struct ListNode * tail; }; struct ListNode { struct ListNode * next; struct ListNode * previous; void * data; }; // Functions: // ========== struct List * createList(enum DataType type); size_t appendToList(enum DataType type, struct List * list, void * data); void * deleteListNodeFromList(size_t index, struct List * list); ssize_t indexOfFromList(bool (*comparisonFunction)(void *, void *), void * data, struct List * list); void * getFirstFromList(bool (*comparisonFunction)(void *, void *), void * data, struct List * list); bool isInList(bool (*comparisonFunction)(void *, void *), void * data, struct List * list); bool isPointerInList(void * data, struct List * list); #endif // ============================================= // | End of lists.h, copyright notice follows. | // ============================================= // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see .