Prepare for SDCC 4.5.0 release.
[sdcc.git] / sdcc / device / lib / isspace.c
blob6c13146af0016f0105312d8095b82af56dbb96c6
1 /*-------------------------------------------------------------------------
2 isspace.c
4 Philipp Klaus Krause, philipp@informatik.uni-frankfurt.de 2013
6 (c) 2013 Goethe-Universität Frankfurt
7 (c) 2022 Sebastian 'basxto' Riedel
9 This library is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the
11 Free Software Foundation; either version 2, or (at your option) any
12 later version.
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this library; see the file COPYING. If not, write to the
21 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 MA 02110-1301, USA.
24 As a special exception, if you link this library with other files,
25 some of which are compiled with SDCC, to produce an executable,
26 this library does not by itself cause the resulting executable to
27 be covered by the GNU General Public License. This exception does
28 not however invalidate any other reasons why the executable file
29 might be covered by the GNU General Public License.
30 -------------------------------------------------------------------------*/
32 #include <ctype.h>
34 #ifdef isspace
35 #undef isspace
36 #endif
38 // ' ' and '\n' are most common; '\t' to '\r' ordered by value
39 int isspace (int c)
41 #if defined ( __SDCC_sm83 ) || defined ( __SDCC_z80 ) || defined ( __SDCC_z80n ) || defined ( __SDCC_z180 ) || defined ( __SDCC_ez80_z80 ) || defined ( __SDCC_mos6502 )
42 if((c & 0xff00) != 0)
43 return 0;
44 return ((unsigned char)c == ' ' || (unsigned char)c == '\t' || (unsigned char)c == '\n' || (unsigned char)c == '\v' || (unsigned char)c == '\f' || (unsigned char)c == '\r');
45 #else
46 return (c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r');
47 #endif