annotate lib/bitsetv.h @ 40159:069b50a66104

bitsetv: allow free on NULL. * lib/bitsetv.c (bitsetv_free): Do nothing when the bitsetv is NULL.
author Akim Demaille <akim.demaille@gmail.com>
date Sun, 27 Jan 2019 18:49:36 +0100
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39975
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
1 /* Bitset vectors.
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
2
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 39975
diff changeset
3 Copyright (C) 2002, 2004, 2009-2015, 2018-2019 Free Software Foundation,
39975
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
4 Inc.
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
5
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
6 Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz).
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
7
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
8 This program is free software: you can redistribute it and/or modify
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
11 (at your option) any later version.
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
12
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
16 GNU General Public License for more details.
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
17
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
20
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
21 #ifndef _BITSETV_H
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
22 #define _BITSETV_H
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
23
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
24 #include "bitset.h"
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
25
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
26 typedef bitset * bitsetv;
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
27
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
28 /* Create a vector of N_VECS bitsets, each of N_BITS, and of
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
29 type TYPE. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
30 bitsetv bitsetv_alloc (bitset_bindex, bitset_bindex, enum bitset_type);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
31
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
32 /* Create a vector of N_VECS bitsets, each of N_BITS, and with
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
33 attribute hints specified by ATTR. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
34 bitsetv bitsetv_create (bitset_bindex, bitset_bindex, unsigned);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
35
40159
069b50a66104 bitsetv: allow free on NULL.
Akim Demaille <akim.demaille@gmail.com>
parents: 40057
diff changeset
36 /* Free vector of bitsets. Do nothing if NULL. */
39975
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
37 void bitsetv_free (bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
38
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
39 /* Zero vector of bitsets. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
40 void bitsetv_zero (bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
41
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
42 /* Set vector of bitsets. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
43 void bitsetv_ones (bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
44
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
45 /* Given a vector BSETV of N bitsets of size N, modify its contents to
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
46 be the transitive closure of what was given. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
47 void bitsetv_transitive_closure (bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
48
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
49 /* Given a vector BSETV of N bitsets of size N, modify its contents to
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
50 be the reflexive transitive closure of what was given. This is
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
51 the same as transitive closure but with all bits on the diagonal
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
52 of the bit matrix set. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
53 void bitsetv_reflexive_transitive_closure (bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
54
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
55 /* Dump vector of bitsets. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
56 void bitsetv_dump (FILE *, const char *, const char *, bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
57
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
58 /* Function to debug vector of bitsets from debugger. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
59 void debug_bitsetv (bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
60
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
61 /* Dump vector of bitsets as a matrix. */
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
62 void bitsetv_matrix_dump (FILE *, const char *, bitsetv);
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
63
90954bfe8d66 bitsetv: new module
Akim Demaille <akim.demaille@gmail.com>
parents:
diff changeset
64 #endif /* _BITSETV_H */