1 /* do not edit automatically generated by mc from alists. */
2 /* alists.def address lists module.
4 Copyright (C) 2015-2025 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.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 (_alists_H)
33 # if !defined (PROC_D)
35 typedef void (*PROC_t
) (void);
36 typedef struct { PROC_t proc
; } PROC
;
41 # if defined (_alists_C)
44 # define EXTERN extern
47 #if !defined (alists_alist_D)
48 # define alists_alist_D
49 typedef void *alists_alist
;
52 typedef struct alists_performOperation_p alists_performOperation
;
54 typedef void (*alists_performOperation_t
) (void *);
55 struct alists_performOperation_p
{ alists_performOperation_t proc
; };
59 initList - creates a new alist, l.
62 EXTERN alists_alist
alists_initList (void);
65 killList - deletes the complete alist, l.
68 EXTERN
void alists_killList (alists_alist
*l
);
71 putItemIntoList - places an ADDRESS, c, into alist, l.
74 EXTERN
void alists_putItemIntoList (alists_alist l
, void * c
);
77 getItemFromList - retrieves the nth ADDRESS from alist, l.
80 EXTERN
void * alists_getItemFromList (alists_alist l
, unsigned int n
);
83 getIndexOfList - returns the index for ADDRESS, c, in alist, l.
84 If more than one CARDINAL, c, exists the index
85 for the first is returned.
88 EXTERN
unsigned int alists_getIndexOfList (alists_alist l
, void * c
);
91 noOfItemsInList - returns the number of items in alist, l.
94 EXTERN
unsigned int alists_noOfItemsInList (alists_alist l
);
97 includeItemIntoList - adds an ADDRESS, c, into a alist providing
98 the value does not already exist.
101 EXTERN
void alists_includeItemIntoList (alists_alist l
, void * c
);
104 removeItemFromList - removes an ADDRESS, c, from a alist.
105 It assumes that this value only appears once.
108 EXTERN
void alists_removeItemFromList (alists_alist l
, void * c
);
111 isItemInList - returns true if a ADDRESS, c, was found in alist, l.
114 EXTERN
bool alists_isItemInList (alists_alist l
, void * c
);
117 foreachItemInListDo - calls procedure, P, foreach item in alist, l.
120 EXTERN
void alists_foreachItemInListDo (alists_alist l
, alists_performOperation p
);
123 duplicateList - returns a duplicate alist derived from, l.
126 EXTERN alists_alist
alists_duplicateList (alists_alist l
);
129 equalList - returns TRUE if left contains the same information as right.
132 EXTERN
bool alists_equalList (alists_alist left
, alists_alist right
);