X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=functions%2Fctype%2Fisxdigit.c;fp=functions%2Fctype%2Fisxdigit.c;h=55818dff272952fe41596fa301c16d7fa109e787;hb=f55a1b46c818376556332a6475c0b70a7539fd68;hp=0000000000000000000000000000000000000000;hpb=ad9db5af1af0576b1ac057e35917c08ece7411ba;p=fw%2Fpdclib diff --git a/functions/ctype/isxdigit.c b/functions/ctype/isxdigit.c new file mode 100644 index 0000000..55818df --- /dev/null +++ b/functions/ctype/isxdigit.c @@ -0,0 +1,38 @@ +/* $Id$ */ + +/* isxdigit( int ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +int isxdigit( int c ) +{ + return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_XDIGT ); +} + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + TESTCASE( isxdigit( '0' ) ); + TESTCASE( isxdigit( '9' ) ); + TESTCASE( isxdigit( 'a' ) ); + TESTCASE( isxdigit( 'f' ) ); + TESTCASE( ! isxdigit( 'g' ) ); + TESTCASE( isxdigit( 'A' ) ); + TESTCASE( isxdigit( 'F' ) ); + TESTCASE( ! isxdigit( 'G' ) ); + TESTCASE( ! isxdigit( '@' ) ); + TESTCASE( ! isxdigit( ' ' ) ); + return TEST_RESULTS; +} + +#endif