Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
/*
22
 * Copyright (C) 1999 Massimiliano Giorgi
23
 *
24
 * This program is free software; you can redistribute it and/or modify
25
 * it under the terms of the GNU General Public License as published by
26
 * the Free Software Foundation; either version 2 of the License, or
27
 * (at your option) any later version.
28
 *
29
 * This program is distributed in the hope that it will be useful,
30
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 * GNU General Public License for more details.
33
 *
34
 * You should have received a copy of the GNU General Public License
35
 * along with this program; if not, write to the Free Software
36
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
37
 *
38
 */
39
 
40
/*
41
 * CVS :        $Id: ctype.h,v 1.1.1.1 2002-03-29 14:12:50 pj Exp $
42
 *
43
 * File:        $File$
44
 * Revision:    $Revision: 1.1.1.1 $
45
 * Last update: $Date: 2002-03-29 14:12:50 $
46
 */
47
 
48
/* MODIFIED from GLibc 2.x.x */
49
 
50
/* Copyright (C) 1991,92,93,95,96,97,98,99 Free Software Foundation, Inc.
51
   This file is part of the GNU C Library.
52
 
53
   The GNU C Library is free software; you can redistribute it and/or
54
   modify it under the terms of the GNU Library General Public License as
55
   published by the Free Software Foundation; either version 2 of the
56
   License, or (at your option) any later version.
57
 
58
   The GNU C Library is distributed in the hope that it will be useful,
59
   but WITHOUT ANY WARRANTY; without even the implied warranty of
60
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
61
   Library General Public License for more details.
62
 
63
   You should have received a copy of the GNU Library General Public
64
   License along with the GNU C Library; see the file COPYING.LIB.  If not,
65
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
66
   Boston, MA 02111-1307, USA.  */
67
 
68
/*
69
 *      ISO C Standard 4.3: CHARACTER HANDLING  <ctype.h>
70
 */
71
 
72
#ifndef _CTYPE_H
73
#define _CTYPE_H        1
74
 
75
#include <features.h>
76
#include <bits/types.h>
77
 
78
#include <ll/ctype.h>
79
 
80
__BEGIN_DECLS
81
 
82
#ifndef _ISbit
83
/* These are all the characteristics of characters.
84
   If there get to be more than 16 distinct characteristics,
85
   many things must be changed that use `unsigned short int's.
86
 
87
   The characteristics are stored always in network byte order (big
88
   endian).  We define the bit value interpretations here dependent on the
89
   machine's byte order.  */
90
 
91
# include <endian.h>
92
# if __BYTE_ORDER == __BIG_ENDIAN
93
#  define _ISbit(bit)   (1 << (bit))
94
# else /* __BYTE_ORDER == __LITTLE_ENDIAN */
95
#  define _ISbit(bit)   ((bit) < 8 ? ((1 << (bit)) << 8) : ((1 << (bit)) >> 8))
96
# endif
97
 
98
enum
99
{
100
  _ISupper  = _ISbit (0),       /* UPPERCASE.  */
101
  _ISlower  = _ISbit (1),       /* lowercase.  */
102
  _ISalpha  = _ISbit (2),       /* Alphabetic.  */
103
  _ISdigit  = _ISbit (3),       /* Numeric.  */
104
  _ISxdigit = _ISbit (4),       /* Hexadecimal numeric.  */
105
  _ISspace  = _ISbit (5),       /* Whitespace.  */
106
  _ISprint  = _ISbit (6),       /* Printing.  */
107
  _ISgraph  = _ISbit (7),       /* Graphical.  */
108
  _ISblank  = _ISbit (8),       /* Blank (usually SPC and TAB).  */
109
  _IScntrl  = _ISbit (9),       /* Control character.  */
110
  _ISpunct  = _ISbit (10),      /* Punctuation.  */
111
  _ISalnum  = _ISbit (11)       /* Alphanumeric.  */
112
};
113
#endif /* ! _ISbit  */
114
 
115
/* These are defined in ctype-info.c.
116
   The declarations here must match those in localeinfo.h.
117
 
118
   These point into arrays of 384, so they can be indexed by any `unsigned
119
   char' value [0,255]; by EOF (-1); or by any `signed char' value
120
   [-128,-1).  ISO C requires that the ctype functions work for `unsigned
121
   char' values and for EOF; we also support negative `signed char' values
122
   for broken old programs.  The case conversion arrays are of `int's
123
   rather than `unsigned char's because tolower (EOF) must be EOF, which
124
   doesn't fit into an `unsigned char'.  But today more important is that
125
   the arrays are also used for multi-byte character sets.  */
126
extern __const unsigned short int *__ctype_b;   /* Characteristics.  */
127
 
128
#define __isctype(c, type) \
129
  (__ctype_b[(int) (c)] & (unsigned short int) type)
130
 
131
#define __isascii(c)     (((c) & ~0x7f) == 0)   /* If C is a 7 bit value.  */
132
#define __toascii(c)     ((c) & 0x7f)           /* Mask off high bits.  */
133
 
134
#define isalnum(c)       __isctype((c), _ISalnum)
135
#define isalpha(c)       __isctype((c), _ISalpha)
136
#define iscntrl(c)       __isctype((c), _IScntrl)
137
#define isdigit(c)       __isctype((c), _ISdigit)
138
#define islower(c)       __isctype((c), _ISlower)
139
#define isgraph(c)       __isctype((c), _ISgraph)
140
#define isprint(c)       __isctype((c), _ISprint)
141
#define ispunct(c)       __isctype((c), _ISpunct)
142
#define isxdigit(c)      __isctype((c), _ISxdigit)
143
#define isblank(c)       __isctype((c), _ISblank)
144
 
145
#define isascii(c)       __isascii (c)
146
#define toascii(c)       __toascii (c)
147
 
148
__END_DECLS
149
 
150
#endif /* ctype.h  */