updated Scintilla to 2.29
[TortoiseGit.git] / ext / scintilla / lexlib / CharacterSet.cxx
blob86e08a1ac417560e72fa7e22b01636e9d5e4107e
1 // Scintilla source code edit control
2 /** @file CharacterSet.cxx
3 ** Simple case functions for ASCII.
4 ** Lexer infrastructure.
5 **/
6 // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
7 // The License.txt file describes the conditions under which this software may be distributed.
9 #include <stdlib.h>
10 #include <string.h>
11 #include <ctype.h>
12 #include <stdio.h>
13 #include <assert.h>
15 #include "CharacterSet.h"
17 #ifdef SCI_NAMESPACE
18 using namespace Scintilla;
19 #endif
21 #ifdef SCI_NAMESPACE
22 namespace Scintilla {
23 #endif
25 int CompareCaseInsensitive(const char *a, const char *b) {
26 while (*a && *b) {
27 if (*a != *b) {
28 char upperA = MakeUpperCase(*a);
29 char upperB = MakeUpperCase(*b);
30 if (upperA != upperB)
31 return upperA - upperB;
33 a++;
34 b++;
36 // Either *a or *b is nul
37 return *a - *b;
40 int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
41 while (*a && *b && len) {
42 if (*a != *b) {
43 char upperA = MakeUpperCase(*a);
44 char upperB = MakeUpperCase(*b);
45 if (upperA != upperB)
46 return upperA - upperB;
48 a++;
49 b++;
50 len--;
52 if (len == 0)
53 return 0;
54 else
55 // Either *a or *b is nul
56 return *a - *b;
59 #ifdef SCI_NAMESPACE
61 #endif