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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [language/] [c/] [libc/] [i18n/] [v2_0/] [include/] [ctype.inl] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_LIBC_CTYPE_INL
2
#define CYGONCE_LIBC_CTYPE_INL
3
/*===========================================================================
4
//
5
//      ctype.inl
6
//
7
//      Inline implementations of ISO standard ctype routines defined in
8
//      section 7.3 of the standard
9
//
10
//===========================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//===========================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    jlarmour
47
// Contributors:
48
// Date:         2000-04-14
49
// Purpose:
50
// Description:
51
// Usage:        Do not include this file directly - use #include 
52
//
53
//####DESCRIPTIONEND####
54
//
55
//=========================================================================*/
56
 
57
/* CONFIGURATION */
58
 
59
#include    /* Configuration header */
60
 
61
/* The outline implementation will override this to prevent inlining */
62
#ifndef CYGPRI_LIBC_I18N_CTYPE_INLINE
63
# define CYGPRI_LIBC_I18N_CTYPE_INLINE extern __inline__
64
#endif
65
 
66
/* FUNCTIONS */
67
 
68
#ifdef __cplusplus
69
extern "C" {
70
#endif
71
 
72
/*=========================================================================*/
73
 
74
/* 7.3.1 Character testing functions */
75
 
76
 
77
CYGPRI_LIBC_I18N_CTYPE_INLINE int
78
isupper( int c )
79
{
80
    return (('A' <= c) && (c <= 'Z'));
81
} /* isupper() */
82
 
83
 
84
CYGPRI_LIBC_I18N_CTYPE_INLINE int
85
islower( int c )
86
{
87
    return (('a' <= c) && (c <= 'z'));
88
} /* islower() */
89
 
90
 
91
CYGPRI_LIBC_I18N_CTYPE_INLINE int
92
isalpha( int c )
93
{
94
    return ( islower(c) || isupper(c) );
95
} /* isalpha() */
96
 
97
 
98
CYGPRI_LIBC_I18N_CTYPE_INLINE int
99
isdigit( int c )
100
{
101
    return ( ('0' <= c) && (c <= '9') );
102
} /* isdigit() */
103
 
104
 
105
CYGPRI_LIBC_I18N_CTYPE_INLINE int
106
isalnum( int c )
107
{
108
    return ( isalpha(c) || isdigit(c) );
109
} /* isalnum() */
110
 
111
 
112
CYGPRI_LIBC_I18N_CTYPE_INLINE int
113
iscntrl( int c )
114
{
115
    /* Simple standard 7-bit ASCII map is assumed */
116
    return ( ((0 <= c) && (c <= 0x1F)) ||
117
             (c == 0x7F) );
118
} /* iscntrl() */
119
 
120
 
121
CYGPRI_LIBC_I18N_CTYPE_INLINE int
122
isgraph( int c )
123
{
124
    // Simple standard 7-bit ASCII map is assumed
125
    return ( ('!' <= c) && (c <= '~') );
126
} /* isgraph() */
127
 
128
 
129
CYGPRI_LIBC_I18N_CTYPE_INLINE int
130
isprint( int c )
131
{
132
    /* Simple standard 7-bit ASCII map is assumed */
133
    return ( (' ' <= c) && (c <= '~') );
134
} /* isprint() */
135
 
136
 
137
CYGPRI_LIBC_I18N_CTYPE_INLINE int
138
ispunct( int c )
139
{
140
    /* Simple standard 7-bit ASCII map is assumed */
141
    return ( (('!' <= c) && (c <= '/')) ||   // ASCII 0x21 - 0x2F
142
             ((':' <= c) && (c <= '@')) ||   // ASCII 0x3A - 0x40
143
             (('[' <= c) && (c <= '`')) ||   // ASCII 0x5B - 0x60
144
             (('{' <= c) && (c <= '~')) );   // ASCII 0x7B - 0x7E
145
 
146
} /* ispunct() */
147
 
148
 
149
CYGPRI_LIBC_I18N_CTYPE_INLINE int
150
isspace( int c )
151
{
152
    return ( (c == ' ') || (c == '\f') || (c == '\n') || (c == '\r') ||
153
             (c == '\t') || (c == '\v') );
154
} /* isspace() */
155
 
156
 
157
CYGPRI_LIBC_I18N_CTYPE_INLINE int
158
isxdigit( int c )
159
{
160
    return ( isdigit(c) ||
161
             (('a' <= c) && (c <= 'f')) ||
162
             (('A' <= c) && (c <= 'F')) );
163
} /* isxdigit() */
164
 
165
/*========================================================================*/
166
 
167
/* 7.3.2 Character case mapping functions */
168
 
169
 
170
CYGPRI_LIBC_I18N_CTYPE_INLINE int
171
tolower( int c )
172
{
173
    return isupper(c) ? c - 'A' + 'a' : c;
174
} /* tolower() */
175
 
176
 
177
CYGPRI_LIBC_I18N_CTYPE_INLINE int
178
toupper( int c )
179
{
180
    return islower(c) ? c - 'a' + 'A' : c;
181
} /* toupper() */
182
 
183
#ifdef __cplusplus
184
}   /* extern "C" */
185
#endif
186
 
187
#endif /* CYGONCE_LIBC_CTYPE_INL multiple inclusion protection */
188
 
189
/* EOF ctype.inl */

powered by: WebSVN 2.1.0

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