]>
Commit | Line | Data |
---|---|---|
1eee94d3 GM |
1 | /* do not edit automatically generated by mc from alists. */ |
2 | /* alists.def address lists module. | |
3 | ||
83ffe9cd | 4 | Copyright (C) 2015-2023 Free Software Foundation, Inc. |
1eee94d3 GM |
5 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. |
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 (_alists_H) | |
25 | # define _alists_H | |
26 | ||
27 | #include "config.h" | |
28 | #include "system.h" | |
29 | # ifdef __cplusplus | |
30 | extern "C" { | |
31 | # endif | |
32 | # if !defined (PROC_D) | |
33 | # define PROC_D | |
34 | typedef void (*PROC_t) (void); | |
35 | typedef struct { PROC_t proc; } PROC; | |
36 | # endif | |
37 | ||
38 | # include "GSYSTEM.h" | |
39 | ||
40 | # if defined (_alists_C) | |
41 | # define EXTERN | |
42 | # else | |
43 | # define EXTERN extern | |
44 | # endif | |
45 | ||
46 | #if !defined (alists_alist_D) | |
47 | # define alists_alist_D | |
48 | typedef void *alists_alist; | |
49 | #endif | |
50 | ||
51 | typedef struct alists_performOperation_p alists_performOperation; | |
52 | ||
53 | typedef void (*alists_performOperation_t) (void *); | |
54 | struct alists_performOperation_p { alists_performOperation_t proc; }; | |
55 | ||
56 | ||
57 | /* | |
58 | initList - creates a new alist, l. | |
59 | */ | |
60 | ||
61 | EXTERN alists_alist alists_initList (void); | |
62 | ||
63 | /* | |
64 | killList - deletes the complete alist, l. | |
65 | */ | |
66 | ||
67 | EXTERN void alists_killList (alists_alist *l); | |
68 | ||
69 | /* | |
70 | putItemIntoList - places an ADDRESS, c, into alist, l. | |
71 | */ | |
72 | ||
73 | EXTERN void alists_putItemIntoList (alists_alist l, void * c); | |
74 | ||
75 | /* | |
76 | getItemFromList - retrieves the nth ADDRESS from alist, l. | |
77 | */ | |
78 | ||
79 | EXTERN void * alists_getItemFromList (alists_alist l, unsigned int n); | |
80 | ||
81 | /* | |
82 | getIndexOfList - returns the index for ADDRESS, c, in alist, l. | |
83 | If more than one CARDINAL, c, exists the index | |
84 | for the first is returned. | |
85 | */ | |
86 | ||
87 | EXTERN unsigned int alists_getIndexOfList (alists_alist l, void * c); | |
88 | ||
89 | /* | |
90 | noOfItemsInList - returns the number of items in alist, l. | |
91 | */ | |
92 | ||
93 | EXTERN unsigned int alists_noOfItemsInList (alists_alist l); | |
94 | ||
95 | /* | |
96 | includeItemIntoList - adds an ADDRESS, c, into a alist providing | |
97 | the value does not already exist. | |
98 | */ | |
99 | ||
100 | EXTERN void alists_includeItemIntoList (alists_alist l, void * c); | |
101 | ||
102 | /* | |
103 | removeItemFromList - removes an ADDRESS, c, from a alist. | |
104 | It assumes that this value only appears once. | |
105 | */ | |
106 | ||
107 | EXTERN void alists_removeItemFromList (alists_alist l, void * c); | |
108 | ||
109 | /* | |
110 | isItemInList - returns true if a ADDRESS, c, was found in alist, l. | |
111 | */ | |
112 | ||
113 | EXTERN unsigned int alists_isItemInList (alists_alist l, void * c); | |
114 | ||
115 | /* | |
116 | foreachItemInListDo - calls procedure, P, foreach item in alist, l. | |
117 | */ | |
118 | ||
119 | EXTERN void alists_foreachItemInListDo (alists_alist l, alists_performOperation p); | |
120 | ||
121 | /* | |
122 | duplicateList - returns a duplicate alist derived from, l. | |
123 | */ | |
124 | ||
125 | EXTERN alists_alist alists_duplicateList (alists_alist l); | |
126 | # ifdef __cplusplus | |
127 | } | |
128 | # endif | |
129 | ||
130 | # undef EXTERN | |
131 | #endif |