| 1 |
/* do not edit automatically generated by mc from lists. */ |
| 2 |
/* lists.def Provides an unordered list manipulation package. |
| 3 |
|
| 4 |
Copyright (C) 2015-2025 Free Software Foundation, Inc. |
| 5 |
Contributed by Gaius Mulley <[email protected]>. |
| 6 |
|
| 7 |
This file is part of GNU Modula-2. |
| 8 |
|
| 9 |
GNU Modula-2 is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation; either version 3, or (at your option) |
| 12 |
any later version. |
| 13 |
|
| 14 |
GNU Modula-2 is distributed in the hope that it will be useful, but |
| 15 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License |
| 20 |
along with GNU Modula-2; see the file COPYING3. If not see |
| 21 |
<http://www.gnu.org/licenses/>. */ |
| 22 |
|
| 23 |
|
| 24 |
#if !defined (_lists_H) |
| 25 |
# define _lists_H |
| 26 |
|
| 27 |
#include "config.h" |
| 28 |
#include "system.h" |
| 29 |
# ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
# endif |
| 32 |
#include <stdbool.h> |
| 33 |
# if !defined (PROC_D) |
| 34 |
# define PROC_D |
| 35 |
typedef void (*PROC_t) (void); |
| 36 |
typedef struct { PROC_t proc; } PROC; |
| 37 |
# endif |
| 38 |
|
| 39 |
# include "GSYSTEM.h" |
| 40 |
# include "GsymbolKey.h" |
| 41 |
|
| 42 |
# if defined (_lists_C) |
| 43 |
# define EXTERN |
| 44 |
# else |
| 45 |
# define EXTERN extern |
| 46 |
# endif |
| 47 |
|
| 48 |
#if !defined (lists_list_D) |
| 49 |
# define lists_list_D |
| 50 |
typedef void *lists_list; |
| 51 |
#endif |
| 52 |
|
| 53 |
|
| 54 |
/* |
| 55 |
initList - creates a new list, l. |
| 56 |
*/ |
| 57 |
|
| 58 |
EXTERN lists_list lists_initList (void); |
| 59 |
|
| 60 |
/* |
| 61 |
killList - deletes the complete list, l. |
| 62 |
*/ |
| 63 |
|
| 64 |
EXTERN void lists_killList (lists_list *l); |
| 65 |
|
| 66 |
/* |
| 67 |
putItemIntoList - places an ADDRESS, c, into list, l. |
| 68 |
*/ |
| 69 |
|
| 70 |
EXTERN void lists_putItemIntoList (lists_list l, void * c); |
| 71 |
|
| 72 |
/* |
| 73 |
getItemFromList - retrieves the nth ADDRESS from list, l. |
| 74 |
*/ |
| 75 |
|
| 76 |
EXTERN void * lists_getItemFromList (lists_list l, unsigned int n); |
| 77 |
|
| 78 |
/* |
| 79 |
getIndexOfList - returns the index for ADDRESS, c, in list, l. |
| 80 |
If more than one CARDINAL, c, exists the index |
| 81 |
for the first is returned. |
| 82 |
*/ |
| 83 |
|
| 84 |
EXTERN unsigned int lists_getIndexOfList (lists_list l, void * c); |
| 85 |
|
| 86 |
/* |
| 87 |
noOfItemsInList - returns the number of items in list, l. |
| 88 |
*/ |
| 89 |
|
| 90 |
EXTERN unsigned int lists_noOfItemsInList (lists_list l); |
| 91 |
|
| 92 |
/* |
| 93 |
includeItemIntoList - adds an ADDRESS, c, into a list providing |
| 94 |
the value does not already exist. |
| 95 |
*/ |
| 96 |
|
| 97 |
EXTERN void lists_includeItemIntoList (lists_list l, void * c); |
| 98 |
|
| 99 |
/* |
| 100 |
removeItemFromList - removes an ADDRESS, c, from a list. |
| 101 |
It assumes that this value only appears once. |
| 102 |
*/ |
| 103 |
|
| 104 |
EXTERN void lists_removeItemFromList (lists_list l, void * c); |
| 105 |
|
| 106 |
/* |
| 107 |
isItemInList - returns true if a ADDRESS, c, was found in list, l. |
| 108 |
*/ |
| 109 |
|
| 110 |
EXTERN bool lists_isItemInList (lists_list l, void * c); |
| 111 |
|
| 112 |
/* |
| 113 |
foreachItemInListDo - calls procedure, P, foreach item in list, l. |
| 114 |
*/ |
| 115 |
|
| 116 |
EXTERN void lists_foreachItemInListDo (lists_list l, symbolKey_performOperation p); |
| 117 |
|
| 118 |
/* |
| 119 |
duplicateList - returns a duplicate list derived from, l. |
| 120 |
*/ |
| 121 |
|
| 122 |
EXTERN lists_list lists_duplicateList (lists_list l); |
| 123 |
# ifdef __cplusplus |
| 124 |
} |
| 125 |
# endif |
| 126 |
|
| 127 |
# undef EXTERN |
| 128 |
#endif |