[444] | 1 | /* |
---|
| 2 | FUNCTION |
---|
| 3 | <<isprint>>, <<isgraph>>, <<isprint_l>>, <<isgraph_l>>---printable character predicates |
---|
| 4 | |
---|
| 5 | INDEX |
---|
| 6 | isprint |
---|
| 7 | |
---|
| 8 | INDEX |
---|
| 9 | isgraph |
---|
| 10 | |
---|
| 11 | INDEX |
---|
| 12 | isprint_l |
---|
| 13 | |
---|
| 14 | INDEX |
---|
| 15 | isgraph_l |
---|
| 16 | |
---|
| 17 | SYNOPSIS |
---|
| 18 | #include <ctype.h> |
---|
| 19 | int isprint(int <[c]>); |
---|
| 20 | int isgraph(int <[c]>); |
---|
| 21 | |
---|
| 22 | #include <ctype.h> |
---|
| 23 | int isprint_l(int <[c]>, locale_t <[locale]>); |
---|
| 24 | int isgraph_l(int <[c]>, locale_t <[locale]>); |
---|
| 25 | |
---|
| 26 | DESCRIPTION |
---|
| 27 | <<isprint>> is a macro which classifies singlebyte charset values by table |
---|
| 28 | lookup. It is a predicate returning non-zero for printable characters, |
---|
| 29 | and 0 for other character arguments. It is defined only if <[c]> is |
---|
| 30 | representable as an unsigned char or if <[c]> is EOF. |
---|
| 31 | |
---|
| 32 | <<isgraph>> behaves identically to <<isprint>>, except that space characters |
---|
| 33 | are excluded. |
---|
| 34 | |
---|
| 35 | <<isprint_l>>, <<isgraph_l>> are like <<isprint>>, <<isgraph>> but perform |
---|
| 36 | the check based on the locale specified by the locale object locale. If |
---|
| 37 | <[locale]> is LC_GLOBAL_LOCALE or not a valid locale object, the behaviour |
---|
| 38 | is undefined. |
---|
| 39 | |
---|
| 40 | You can use a compiled subroutine instead of the macro definition by |
---|
| 41 | undefining either macro using `<<#undef isprint>>' or `<<#undef isgraph>>', |
---|
| 42 | or `<<#undef isprint_l>>' or `<<#undef isgraph_l>>'. |
---|
| 43 | |
---|
| 44 | RETURNS |
---|
| 45 | <<isprint>>, <<isprint_l>> return non-zero if <[c]> is a printing character. |
---|
| 46 | <<isgraph>>, <<isgraph_l>> return non-zero if <[c]> is a printing character |
---|
| 47 | except spaces. |
---|
| 48 | |
---|
| 49 | PORTABILITY |
---|
| 50 | <<isprint>> and <<isgraph>> are ANSI C. |
---|
| 51 | |
---|
| 52 | No supporting OS subroutines are required. |
---|
| 53 | */ |
---|
| 54 | |
---|
| 55 | #include <_ansi.h> |
---|
| 56 | #include <ctype.h> |
---|
| 57 | |
---|
| 58 | #undef isgraph |
---|
| 59 | int |
---|
| 60 | isgraph (int c) |
---|
| 61 | { |
---|
| 62 | return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N)); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | #undef isprint |
---|
| 67 | int |
---|
| 68 | isprint (int c) |
---|
| 69 | { |
---|
| 70 | return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N|_B)); |
---|
| 71 | } |
---|