1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 // free() the result (it will never be NULL)
22 // also converts to lower case
23 extern char *translitstr (const char *src
);
26 /****************************************************************************/
28 /****************************************************************************/
30 static inline int le2lower (int ch
) {
33 if (ch
>= 'A' && ch
<= 'Z') ch
+= 32;
35 if (ch
>= 224 && ch
<= 255) ch
-= 32;
38 case 179: case 180: case 182: case 183: case 189: ch
-= 16; break;
46 static inline int le2upper (int ch
) {
49 if (ch
>= 'a' && ch
<= 'z') ch
-= 32;
51 if (ch
>= 192 && ch
<= 223) ch
+= 32;
54 case 163: case 164: case 166: case 167: case 173: ch
+= 16; break;
62 static inline int leIsAlpha (int ch
) {
64 if (ch
>= 'A' && ch
<= 'Z') return 1;
65 if (ch
>= 'a' && ch
<= 'z') return 1;
66 if (ch
>= 192) return 1;
68 case 163: case 164: case 166: case 167: case 173:
69 case 179: case 180: case 182: case 183: case 189:
77 static inline int leIsDigit (int ch
) { return ch
>= '0' && ch
<= '9'; }
78 static inline int leIsXDigit (int ch
) { ch
= le2upper(ch
); return leIsDigit(ch
) || (ch
>= 'A' && ch
<= 'F'); }
79 static inline int leIsAlNum (int ch
) { return leIsDigit(ch
) || leIsAlpha(ch
); }
80 static inline int leIsUpper (int ch
) { return leIsAlpha(ch
) && ch
== le2upper(ch
); }
81 static inline int leIsLower (int ch
) { return leIsAlpha(ch
) && ch
== le2lower(ch
); }
82 static inline int leIsSpace (int ch
) { return (ch
&& (ch
&0xff) <= 32); }