source: trunk/libs/newlib/src/newlib/libc/ctype/isprint.c @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

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