| 1 | /* Copyright (C) 1995, 1996 Tom Lord |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU Library General Public License as published by |
| 5 | * the Free Software Foundation; either version 2, or (at your option) |
| 6 | * any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU Library General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Library General Public License |
| 14 | * along with this software; see the file COPYING. If not, write to |
| 15 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
| 16 | * Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | /* |
| 21 | * Tom Lord ([email protected], [email protected]) |
| 22 | */ |
| 23 | |
| 24 | |
| 25 | |
| 26 | #include "rxall.h" |
| 27 | #include "rxcset.h" |
| 28 | /* Utilities for manipulating bitset represntations of characters sets. */ |
| 29 | |
| 30 | #ifdef __STDC__ |
| 31 | rx_Bitset |
| 32 | rx_cset (int size) |
| 33 | #else |
| 34 | rx_Bitset |
| 35 | rx_cset (size) |
| 36 | int size; |
| 37 | #endif |
| 38 | { |
| 39 | rx_Bitset b; |
| 40 | b = (rx_Bitset) malloc (rx_sizeof_bitset (size)); |
| 41 | if (b) |
| 42 | rx_bitset_null (size, b); |
| 43 | return b; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | #ifdef __STDC__ |
| 48 | rx_Bitset |
| 49 | rx_copy_cset (int size, rx_Bitset a) |
| 50 | #else |
| 51 | rx_Bitset |
| 52 | rx_copy_cset (size, a) |
| 53 | int size; |
| 54 | rx_Bitset a; |
| 55 | #endif |
| 56 | { |
| 57 | rx_Bitset cs; |
| 58 | cs = rx_cset (size); |
| 59 | |
| 60 | if (cs) |
| 61 | rx_bitset_union (size, cs, a); |
| 62 | |
| 63 | return cs; |
| 64 | } |
| 65 | |
| 66 | |
| 67 | #ifdef __STDC__ |
| 68 | void |
| 69 | rx_free_cset (rx_Bitset c) |
| 70 | #else |
| 71 | void |
| 72 | rx_free_cset (c) |
| 73 | rx_Bitset c; |
| 74 | #endif |
| 75 | { |
| 76 | if (c) |
| 77 | free ((char *)c); |
| 78 | } |
| 79 |