| 1 |
/* do not edit automatically generated by mc from wlists. */ |
| 2 |
/* wlists.def word lists module. |
| 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 (_wlists_H) |
| 25 |
# define _wlists_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 |
|
| 41 |
# if defined (_wlists_C) |
| 42 |
# define EXTERN |
| 43 |
# else |
| 44 |
# define EXTERN extern |
| 45 |
# endif |
| 46 |
|
| 47 |
#if !defined (wlists_wlist_D) |
| 48 |
# define wlists_wlist_D |
| 49 |
typedef void *wlists_wlist; |
| 50 |
#endif |
| 51 |
|
| 52 |
typedef struct wlists_performOperation_p wlists_performOperation; |
| 53 |
|
| 54 |
typedef void (*wlists_performOperation_t) (unsigned int); |
| 55 |
struct wlists_performOperation_p { wlists_performOperation_t proc; }; |
| 56 |
|
| 57 |
|
| 58 |
/* |
| 59 |
initList - creates a new wlist, l. |
| 60 |
*/ |
| 61 |
|
| 62 |
EXTERN wlists_wlist wlists_initList (void); |
| 63 |
|
| 64 |
/* |
| 65 |
killList - deletes the complete wlist, l. |
| 66 |
*/ |
| 67 |
|
| 68 |
EXTERN void wlists_killList (wlists_wlist *l); |
| 69 |
|
| 70 |
/* |
| 71 |
putItemIntoList - places an WORD, c, into wlist, l. |
| 72 |
*/ |
| 73 |
|
| 74 |
EXTERN void wlists_putItemIntoList (wlists_wlist l, unsigned int c); |
| 75 |
|
| 76 |
/* |
| 77 |
getItemFromList - retrieves the nth WORD from wlist, l. |
| 78 |
*/ |
| 79 |
|
| 80 |
EXTERN unsigned int wlists_getItemFromList (wlists_wlist l, unsigned int n); |
| 81 |
|
| 82 |
/* |
| 83 |
getIndexOfList - returns the index for WORD, c, in wlist, l. |
| 84 |
If more than one CARDINAL, c, exists the index |
| 85 |
for the first is returned. |
| 86 |
*/ |
| 87 |
|
| 88 |
EXTERN unsigned int wlists_getIndexOfList (wlists_wlist l, unsigned int c); |
| 89 |
|
| 90 |
/* |
| 91 |
noOfItemsInList - returns the number of items in wlist, l. |
| 92 |
*/ |
| 93 |
|
| 94 |
EXTERN unsigned int wlists_noOfItemsInList (wlists_wlist l); |
| 95 |
|
| 96 |
/* |
| 97 |
includeItemIntoList - adds an WORD, c, into a wlist providing |
| 98 |
the value does not already exist. |
| 99 |
*/ |
| 100 |
|
| 101 |
EXTERN void wlists_includeItemIntoList (wlists_wlist l, unsigned int c); |
| 102 |
|
| 103 |
/* |
| 104 |
removeItemFromList - removes an WORD, c, from a wlist. |
| 105 |
It assumes that this value only appears once. |
| 106 |
*/ |
| 107 |
|
| 108 |
EXTERN void wlists_removeItemFromList (wlists_wlist l, unsigned int c); |
| 109 |
|
| 110 |
/* |
| 111 |
replaceItemInList - replace the nth WORD in wlist, l. |
| 112 |
The first item in a wlists is at index, 1. |
| 113 |
If the index, n, is out of range nothing is changed. |
| 114 |
*/ |
| 115 |
|
| 116 |
EXTERN void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsigned int w); |
| 117 |
|
| 118 |
/* |
| 119 |
isItemInList - returns true if a WORD, c, was found in wlist, l. |
| 120 |
*/ |
| 121 |
|
| 122 |
EXTERN bool wlists_isItemInList (wlists_wlist l, unsigned int c); |
| 123 |
|
| 124 |
/* |
| 125 |
foreachItemInListDo - calls procedure, P, foreach item in wlist, l. |
| 126 |
*/ |
| 127 |
|
| 128 |
EXTERN void wlists_foreachItemInListDo (wlists_wlist l, wlists_performOperation p); |
| 129 |
|
| 130 |
/* |
| 131 |
duplicateList - returns a duplicate wlist derived from, l. |
| 132 |
*/ |
| 133 |
|
| 134 |
EXTERN wlists_wlist wlists_duplicateList (wlists_wlist l); |
| 135 |
# ifdef __cplusplus |
| 136 |
} |
| 137 |
# endif |
| 138 |
|
| 139 |
# undef EXTERN |
| 140 |
#endif |