1 /* do not edit automatically generated by mc from wlists. */
2 /* wlists.def word lists module.
4 Copyright (C) 2015-2024 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius@glam.ac.uk>.
7 This file is part of GNU Modula-2.
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)
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.
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/>. */
24 #if !defined (_wlists_H)
33 # if !defined (PROC_D)
35 typedef void (*PROC_t
) (void);
36 typedef struct { PROC_t proc
; } PROC
;
41 # if defined (_wlists_C)
44 # define EXTERN extern
47 #if !defined (wlists_wlist_D)
48 # define wlists_wlist_D
49 typedef void *wlists_wlist
;
52 typedef struct wlists_performOperation_p wlists_performOperation
;
54 typedef void (*wlists_performOperation_t
) (unsigned int);
55 struct wlists_performOperation_p
{ wlists_performOperation_t proc
; };
59 initList - creates a new wlist, l.
62 EXTERN wlists_wlist
wlists_initList (void);
65 killList - deletes the complete wlist, l.
68 EXTERN
void wlists_killList (wlists_wlist
*l
);
71 putItemIntoList - places an WORD, c, into wlist, l.
74 EXTERN
void wlists_putItemIntoList (wlists_wlist l
, unsigned int c
);
77 getItemFromList - retrieves the nth WORD from wlist, l.
80 EXTERN
unsigned int wlists_getItemFromList (wlists_wlist l
, unsigned int n
);
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.
88 EXTERN
unsigned int wlists_getIndexOfList (wlists_wlist l
, unsigned int c
);
91 noOfItemsInList - returns the number of items in wlist, l.
94 EXTERN
unsigned int wlists_noOfItemsInList (wlists_wlist l
);
97 includeItemIntoList - adds an WORD, c, into a wlist providing
98 the value does not already exist.
101 EXTERN
void wlists_includeItemIntoList (wlists_wlist l
, unsigned int c
);
104 removeItemFromList - removes an WORD, c, from a wlist.
105 It assumes that this value only appears once.
108 EXTERN
void wlists_removeItemFromList (wlists_wlist l
, unsigned int c
);
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.
116 EXTERN
void wlists_replaceItemInList (wlists_wlist l
, unsigned int n
, unsigned int w
);
119 isItemInList - returns true if a WORD, c, was found in wlist, l.
122 EXTERN
bool wlists_isItemInList (wlists_wlist l
, unsigned int c
);
125 foreachItemInListDo - calls procedure, P, foreach item in wlist, l.
128 EXTERN
void wlists_foreachItemInListDo (wlists_wlist l
, wlists_performOperation p
);
131 duplicateList - returns a duplicate wlist derived from, l.
134 EXTERN wlists_wlist
wlists_duplicateList (wlists_wlist l
);