OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [ctype/] [isprint.c] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1005 ivang
 
2
/*
3
FUNCTION
4
        <<isprint>>, <<isgraph>>---printable character predicates
5
 
6
INDEX
7
        isprint
8
INDEX
9
        isgraph
10
 
11
ANSI_SYNOPSIS
12
        #include <ctype.h>
13
        int isprint(int <[c]>);
14
        int isgraph(int <[c]>);
15
 
16
TRAD_SYNOPSIS
17
        #include <ctype.h>
18
        int isprint(<[c]>);
19
        int isgraph(<[c]>);
20
 
21
 
22
DESCRIPTION
23
<<isprint>> is a macro which classifies ASCII integer values by table
24
lookup.  It is a predicate returning non-zero for printable
25
characters, and 0 for other character arguments.
26
It is defined only when <<isascii>>(<[c]>) is true or <[c]> is EOF.
27
 
28
You can use a compiled subroutine instead of the macro definition by
29
undefining either macro using `<<#undef isprint>>' or `<<#undef isgraph>>'.
30
 
31
RETURNS
32
<<isprint>> returns non-zero if <[c]> is a printing character,
33
(<<0x20>>--<<0x7E>>).
34
<<isgraph>> behaves identically to <<isprint>>, except that the space
35
character (<<0x20>>) is excluded.
36
 
37
PORTABILITY
38
<<isprint>> and <<isgraph>> are ANSI C.
39
 
40
No supporting OS subroutines are required.
41
*/
42
 
43
#include <_ansi.h>
44
#include <ctype.h>
45
 
46
#undef isgraph
47
int
48
_DEFUN(isgraph,(c),int c)
49
{
50
        return((_ctype_ + 1)[c] & (_P|_U|_L|_N));
51
}
52
 
53
 
54
#undef isprint
55
int
56
_DEFUN(isprint,(c),int c)
57
{
58
        return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B));
59
}
60
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.