plover/ascii-ctype.h
author J. Ali Harlow <ali@juiblex.co.uk>
Mon Aug 31 07:12:16 2020 +0100 (2020-08-31)
changeset 104 5cb36c12ac49
parent 81 734c6230e41f
permissions -rw-r--r--
Prepare to release 0.6
ali@81
     1
/*
ali@81
     2
 * Copyright (C) 2016, 2018  J. Ali Harlow <ali@juiblex.co.uk>
ali@81
     3
 *
ali@81
     4
 * This program is free software; you can redistribute it and/or modify
ali@81
     5
 * it under the terms of the GNU General Public License as published by
ali@81
     6
 * the Free Software Foundation; either version 2 of the License, or
ali@81
     7
 * (at your option) any later version.
ali@81
     8
 *
ali@81
     9
 * This program is distributed in the hope that it will be useful,
ali@81
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ali@81
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ali@81
    12
 * GNU General Public License for more details.
ali@81
    13
 *
ali@81
    14
 * You should have received a copy of the GNU General Public License along
ali@81
    15
 * with this program; if not, write to the Free Software Foundation, Inc.,
ali@81
    16
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ali@81
    17
 */
ali@81
    18
ali@81
    19
#ifndef __ASCII_CTYPE_H__
ali@81
    20
#define __ASCII_CTYPE_H__
ali@81
    21
ali@81
    22
/*
ali@81
    23
 * Avoid g_ascii_ family because of complications with static builds
ali@81
    24
 * of glib2 under Windows. The real problem is probably in how glib2
ali@81
    25
 * is packaged for cross-compiling in certain distributions, but it's
ali@81
    26
 * easy enough to work around.
ali@81
    27
 */
ali@81
    28
ali@81
    29
#define ascii_islower(c) ((c) >= 'a' && (c) <= 'z')
ali@91
    30
#define ascii_isupper(c) ((c) >= 'A' && (c) <= 'Z')
ali@81
    31
#define ascii_isdigit(c) ((c) >= '0' && (c) <= '9')
ali@81
    32
#define ascii_isalpha(c) (ascii_islower(c) || ascii_isupper(c))
ali@81
    33
#define ascii_isalnum(c) (ascii_isalpha(c) || ascii_isdigit(c))
ali@81
    34
ali@81
    35
#endif /* __ASCII_CTYPE_H__ */