~efargaspro/+junk/codeblocks-16.01-release

« back to all changes in this revision

Viewing changes to src/sdk/wxscintilla/src/scintilla/lexlib/CharacterSet.cxx

  • Committer: damienlmoore at gmail
  • Date: 2016-02-02 02:43:22 UTC
  • Revision ID: damienlmoore@gmail.com-20160202024322-yql5qmtbwdyamdwd
Code::BlocksĀ 16.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
8
 
 
9
#include <stdlib.h>
 
10
#include <string.h>
 
11
#include <stdio.h>
 
12
#include <assert.h>
 
13
#include <ctype.h>
 
14
 
 
15
#include "CharacterSet.h"
 
16
 
 
17
#ifdef SCI_NAMESPACE
 
18
using namespace Scintilla;
 
19
#endif
 
20
 
 
21
#ifdef SCI_NAMESPACE
 
22
namespace Scintilla {
 
23
#endif
 
24
 
 
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;
 
32
                }
 
33
                a++;
 
34
                b++;
 
35
        }
 
36
        // Either *a or *b is nul
 
37
        return *a - *b;
 
38
}
 
39
 
 
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;
 
47
                }
 
48
                a++;
 
49
                b++;
 
50
                len--;
 
51
        }
 
52
        if (len == 0)
 
53
                return 0;
 
54
        else
 
55
                // Either *a or *b is nul
 
56
                return *a - *b;
 
57
}
 
58
 
 
59
#ifdef SCI_NAMESPACE
 
60
}
 
61
#endif