1 /* do not edit automatically generated by mc from lists. */
2 /* lists.def Provides an unordered list manipulation package.
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 (_lists_H)
33 # if !defined (PROC_D)
35 typedef void (*PROC_t
) (void);
36 typedef struct { PROC_t proc
; } PROC
;
40 # include "GsymbolKey.h"
42 # if defined (_lists_C)
45 # define EXTERN extern
48 #if !defined (lists_list_D)
50 typedef void *lists_list
;
55 initList - creates a new list, l.
58 EXTERN lists_list
lists_initList (void);
61 killList - deletes the complete list, l.
64 EXTERN
void lists_killList (lists_list
*l
);
67 putItemIntoList - places an ADDRESS, c, into list, l.
70 EXTERN
void lists_putItemIntoList (lists_list l
, void * c
);
73 getItemFromList - retrieves the nth ADDRESS from list, l.
76 EXTERN
void * lists_getItemFromList (lists_list l
, unsigned int n
);
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.
84 EXTERN
unsigned int lists_getIndexOfList (lists_list l
, void * c
);
87 noOfItemsInList - returns the number of items in list, l.
90 EXTERN
unsigned int lists_noOfItemsInList (lists_list l
);
93 includeItemIntoList - adds an ADDRESS, c, into a list providing
94 the value does not already exist.
97 EXTERN
void lists_includeItemIntoList (lists_list l
, void * c
);
100 removeItemFromList - removes an ADDRESS, c, from a list.
101 It assumes that this value only appears once.
104 EXTERN
void lists_removeItemFromList (lists_list l
, void * c
);
107 isItemInList - returns true if a ADDRESS, c, was found in list, l.
110 EXTERN
bool lists_isItemInList (lists_list l
, void * c
);
113 foreachItemInListDo - calls procedure, P, foreach item in list, l.
116 EXTERN
void lists_foreachItemInListDo (lists_list l
, symbolKey_performOperation p
);
119 duplicateList - returns a duplicate list derived from, l.
122 EXTERN lists_list
lists_duplicateList (lists_list l
);