embclib  0.1
ctype.h
Go to the documentation of this file.
1 
28 #ifndef CTYPE_fb03932e_efff_11e9_b700_705a0f25cb51
29 #define CTYPE_fb03932e_efff_11e9_b700_705a0f25cb51
30 
31 #ifdef __cplusplus
32  extern "C" {
33 #endif
34 
40 #define __CTYPE_VERSION (0x0001u)
42 #include "complier-cfg.h"
43 #include "stddef.h"
44 
55 {
56  if ( ( ( (unsigned)ch | 32U) - 'a' ) < 26 )
57  {
58  return TRUE;
59  }
60  return FALSE;
61 }
62 
73 {
74  if ( ( (unsigned)ch - '0') < 10 )
75  {
76  return TRUE;
77  }
78  return FALSE;
79 }
80 
91 {
92  if ( IsAlpha(ch) || IsDigit(ch) )
93  {
94  return TRUE;
95  }
96  return FALSE;
97 }
98 
108 {
109  if ( !( (unsigned)ch & ~0x7f) )
110  {
111  return TRUE;
112  }
113  return FALSE;
114 }
115 
126 {
127  if ( (ch < 0x20) || (ch == 0x7f) )
128  {
129  return TRUE;
130  }
131  return FALSE;
132 }
133 
145 {
146  if ( ( (unsigned)ch - 0x21) < 0x5e )
147  {
148  return TRUE;
149  }
150  return FALSE;
151 }
152 
164 {
165  if ( IsGraph(ch) && !IsAlphaNumeric(ch) )
166  {
167  return TRUE;
168  }
169  return FALSE;
170 }
171 
182 {
183  if ( ( (unsigned)ch - 0x20) < 0x5f )
184  {
185  return TRUE;
186  }
187  return FALSE;
188 }
189 
200 {
201  if ( ( ( (unsigned)ch - '\t') < 5 ) || ch == ' ' )
202  {
203  return TRUE;
204  }
205  return FALSE;
206 }
207 
218 {
219  if ( ( (unsigned)(ch - '0') < 10 ) || ( (unsigned)(ch | 32) - 'a') < 6 )
220  {
221  return TRUE;
222  }
223  return FALSE;
224 }
225 
236 {
237  if ( (unsigned)(ch - 'a') < 26 )
238  {
239  return TRUE;
240  }
241  return FALSE;
242 }
243 
254 {
255  if ( (unsigned)(ch - 'A') < 26 )
256  {
257  return TRUE;
258  }
259  return FALSE;
260 }
261 
271 {
272  if ( IsUpper(ch) )
273  {
274  return ( ch | 32 );
275  }
276  return (ch);
277 }
278 
288 {
289  if ( IsLower(ch) )
290  {
291  return ( ch & 0x5f );
292  }
293  return (ch);
294 }
295 
296 
297 #ifdef __cplusplus
298 }
299 #endif
300 
301 #endif /* CTYPE_fb03932e_efff_11e9_b700_705a0f25cb51 */
_STATIC_INLINE_ bool_et IsUpper(uint8_t ch)
Check a character is a upper case character or not. Ex. (A-Z)
Definition: ctype.h:253
_STATIC_INLINE_ uint8_t ToLower(uint8_t ch)
Convert a character to lower case character. Ex. (a-z) (A-Z) to (a-z)
Definition: ctype.h:270
bool_et
Boolean data type.
Definition: stddef.h:49
unsigned char uint8_t
8 bit unsigned integer. Unsigned integer type maximun and minimum limits
Definition: stdint.h:68
_STATIC_INLINE_ bool_et IsSpace(uint8_t ch)
Check a character is a space character or not. Ex. space.
Definition: ctype.h:199
_STATIC_INLINE_ bool_et IsHexDigit(uint8_t ch)
Check a character is a hexadecimal character or not. Ex. (0-9) (a-f) (A-F)
Definition: ctype.h:217
_STATIC_INLINE_ uint8_t ToUpper(uint8_t ch)
Convert a character to upper case character. Ex. (a-z) (A-Z) to (A-Z)
Definition: ctype.h:287
_STATIC_INLINE_ bool_et IsAscii(uint8_t ch)
Check a character is an ASCII character or not.
Definition: ctype.h:107
_STATIC_INLINE_ bool_et IsGraph(uint8_t ch)
Check a character is a graphical character or not. Ex. ! " # $ % & ' ( ) * + , - ....
Definition: ctype.h:144
Standard types and ctype function library.
_STATIC_INLINE_ bool_et IsPrintable(uint8_t ch)
Check a character is a printable character or not. Ex. All graphical character IsGraph include space.
Definition: ctype.h:181
#define _STATIC_INLINE_
Definition: complier-cfg.h:37
_STATIC_INLINE_ bool_et IsControl(uint8_t ch)
Check a character is a control character or not. Ex. ( - newline, \t - tab, \r - enter,...
Definition: ctype.h:125
_STATIC_INLINE_ bool_et IsLower(uint8_t ch)
Check a character is a lower case character or not. Ex. (a-z)
Definition: ctype.h:235
_STATIC_INLINE_ bool_et IsAlphaNumeric(uint8_t ch)
Check a character is an alphabetic and number character or not. Ex. (a-z) (A-Z) (0-9)
Definition: ctype.h:90
_STATIC_INLINE_ bool_et IsDigit(uint8_t ch)
Check a character is an number character or not. Ex. (0-9)
Definition: ctype.h:72
_STATIC_INLINE_ bool_et IsAlpha(uint8_t ch)
Check a character is an alphabet or not. Ex. (a-z) and (A-Z)
Definition: ctype.h:54
_STATIC_INLINE_ bool_et IsPunct(uint8_t ch)
Check a character is a punctuation character or not. Ex. ! " # $ % & ' ( ) * + , - ....
Definition: ctype.h:163