summaryrefslogtreecommitdiffstats
path: root/private/crt32/mbstring/ismbdgt.c
blob: e5733261e90e1bef7c7025be39c96de401f679f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*** 
*ismbdgt.c - Test if character is a digit (MBCS)
*
*	Copyright (c) 1985-1992, Microsoft Corporation.  All rights reserved.
*
*Purpose:
*	Test if character is a digit (MBCS)
*
*Revision History:
*	11-19-92  KRS	Ported from 16-bit sources.
*
*******************************************************************************/

#ifdef _MBCS
#include <cruntime.h>
#include <ctype.h>
#include <mbdata.h>
#include <mbctype.h>
#include <mbstring.h>

/***
* _ismbcdigit - Test if character is a digit (MBCS)
*
*Purpose:
*	Tests the character to see if it is a digit.
*	Handles MBCS chars correctly.
*
*	Note:  Use test against 0x00FF instead of _ISLEADBYTE
*	to ensure that we don't call SBCS routine with a two-byte
*	value.
*
*Entry:
*	unsigned int *c = character to test
*
*Exit:
*	Returns TRUE if character is a digit, else FALSE
*
*Exceptions:
*
*******************************************************************************/

int _CRTAPI1 _ismbcdigit(c)
unsigned int c;
{

	if (c > 0x00FF)

#ifdef _MBCS_OS
		return (0);
#else
		if (_mbascii)
			return ((c >= _MBDIGITLOW) && (c <= _MBDIGITHIGH));
		else
			return (0);
#endif

	else
		return (isdigit(c));
}
#endif	/* _MBCS */