| 1 | /* Conversion of files between different charsets and surfaces. |
| 2 | Copyright © 1990-2018 Free Software Foundation, Inc. |
| 3 | Contributed by François Pinard <[email protected]>, 1988. |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public License |
| 7 | as published by the Free Software Foundation; either version 3 of the |
| 8 | License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be |
| 11 | useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
| 12 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the Recode Library; see the file `COPYING.LIB'. |
| 17 | If not, see <https://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include "cleaner.h" |
| 21 | |
| 22 | #include <assert.h> |
| 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <stdbool.h> |
| 26 | #include <string.h> |
| 27 | #include <signal.h> |
| 28 | #include <errno.h> |
| 29 | |
| 30 | #include "xalloc.h" |
| 31 | #include "argmatch.h" |
| 32 | #include "localcharset.h" |
| 33 | #include "error.h" |
| 34 | #include "gettext.h" |
| 35 | |
| 36 | #if ENABLE_NLS |
| 37 | # define _(Text) gettext (Text) |
| 38 | #else |
| 39 | # define _(Text) Text |
| 40 | #endif |
| 41 | #define N_(Text) Text |
| 42 | |
| 43 | #ifndef FALLTHROUGH |
| 44 | # if __GNUC__ < 7 |
| 45 | # define FALLTHROUGH ((void) 0) |
| 46 | # else |
| 47 | # define FALLTHROUGH __attribute__ ((__fallthrough__)) |
| 48 | # endif |
| 49 | #endif |
| 50 | |
| 51 | /* Generate a mask of LENGTH one-bits, right justified in a word. */ |
| 52 | #define BIT_MASK(Length) ((1U << (Length)) - 1) |
| 53 | |
| 54 | /* Indicate if CHARACTER holds into 7 bits. */ |
| 55 | #define IS_ASCII(Character) \ |
| 56 | (!((Character) & ~BIT_MASK (7))) |
| 57 | |
| 58 | #include "recodext.h" |