ReactOS  0.4.14-dev-114-gc8cbd56
ismblead.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS system libraries
4  * FILE: lib/sdk/crt/mbstring/ismblead.c
5  * PURPOSE: Checks for a leading byte
6  * PROGRAMERS:
7  * Copyright 1999 Ariadne, Taiji Yamada
8  * Copyright 1999 Alexandre Julliard
9  * Copyright 2000 Jon Griffths
10  * Copyright 2008 Samuel Serapion adapted from PROJECT C Library
11  *
12  */
13 
14 #include <precomp.h>
15 #include <mbctype.h>
16 
17 /*
18  * @implemented
19  */
20 int _ismbblead(unsigned int c)
21 {
22  return (get_mbcinfo()->mbctype[(c&0xff) + 1] & _M1) != 0;
23 }
24 
25 /*
26  * @implemented
27  */
28 int _ismbslead( const unsigned char *start, const unsigned char *str)
29 {
30  int lead = 0;
31 
32  /* Lead bytes can also be trail bytes so we need to analyse the string
33  */
34  while (start <= str)
35  {
36  if (!*start)
37  return 0;
38  lead = !lead && _ismbblead(*start);
39  start++;
40  }
41 
42  return lead ? -1 : 0;
43 }
44 
45 /*
46  * @implemented
47  */
48 unsigned char *__p__mbctype(void)
49 {
50  return get_mbcinfo()->mbctype;
51 }
52 
53 
unsigned char mbctype[257]
Definition: msvcrt.h:143
int _ismbblead(unsigned int c)
Definition: ismblead.c:20
unsigned char * __p__mbctype(void)
Definition: ismblead.c:48
int _ismbslead(const unsigned char *start, const unsigned char *str)
Definition: ismblead.c:28
const WCHAR * str
const GLubyte * c
Definition: glext.h:8905
MSVCRT_pthreadmbcinfo get_mbcinfo(void)
Definition: locale.c:364
GLuint start
Definition: gl.h:1545
#define _M1
Definition: msvcrt.h:817