Upgrade included Scintilla to version 3.3.9.

Closes #15742.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-12 13:23:54 +00:00
parent b356d1d3c7
commit d6ace87b61
164 changed files with 14615 additions and 4325 deletions

View File

@@ -7,12 +7,13 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <algorithm>
#include "StringCopy.h"
#include "WordList.h"
#ifdef SCI_NAMESPACE
@@ -32,11 +33,11 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
for (int i=0; i<256; i++) {
wordSeparator[i] = false;
}
wordSeparator['\r'] = true;
wordSeparator['\n'] = true;
wordSeparator[static_cast<unsigned int>('\r')] = true;
wordSeparator[static_cast<unsigned int>('\n')] = true;
if (!onlyLineEnds) {
wordSeparator[' '] = true;
wordSeparator['\t'] = true;
wordSeparator[static_cast<unsigned int>(' ')] = true;
wordSeparator[static_cast<unsigned int>('\t')] = true;
}
for (int j = 0; wordlist[j]; j++) {
int curr = static_cast<unsigned char>(wordlist[j]);
@@ -45,29 +46,39 @@ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = fa
prev = curr;
}
char **keywords = new char *[words + 1];
if (keywords) {
words = 0;
int wordsStore = 0;
const size_t slen = strlen(wordlist);
if (words) {
prev = '\0';
size_t slen = strlen(wordlist);
for (size_t k = 0; k < slen; k++) {
if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
if (!prev) {
keywords[words] = &wordlist[k];
words++;
keywords[wordsStore] = &wordlist[k];
wordsStore++;
}
} else {
wordlist[k] = '\0';
}
prev = wordlist[k];
}
keywords[words] = &wordlist[slen];
*len = words;
} else {
*len = 0;
}
keywords[wordsStore] = &wordlist[slen];
*len = wordsStore;
return keywords;
}
WordList::WordList(bool onlyLineEnds_) :
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {
}
WordList::~WordList() {
Clear();
}
WordList::operator bool() const {
return len ? true : false;
}
bool WordList::operator!=(const WordList &other) const {
if (len != other.len)
return true;
@@ -78,6 +89,10 @@ bool WordList::operator!=(const WordList &other) const {
return false;
}
int WordList::Length() const {
return len;
}
void WordList::Clear() {
if (words) {
delete []list;
@@ -91,7 +106,7 @@ void WordList::Clear() {
#ifdef _MSC_VER
static bool cmpWords(const char *a, const char *b) {
return strcmp(a, b) == -1;
return strcmp(a, b) < 0;
}
#else
@@ -108,15 +123,16 @@ static void SortWordList(char **words, unsigned int len) {
void WordList::Set(const char *s) {
Clear();
list = new char[strlen(s) + 1];
strcpy(list, s);
const size_t lenS = strlen(s) + 1;
list = new char[lenS];
memcpy(list, s, lenS);
words = ArrayFromWordList(list, &len, onlyLineEnds);
#ifdef _MSC_VER
std::sort(words, words + len, cmpWords);
#else
SortWordList(words, len);
#endif
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
for (unsigned int k = 0; k < ELEMENTS(starts); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
unsigned char indexChar = words[l][0];
@@ -149,7 +165,7 @@ bool WordList::InList(const char *s) const {
j++;
}
}
j = starts['^'];
j = starts[static_cast<unsigned int>('^')];
if (j >= 0) {
while (words[j][0] == '^') {
const char *a = words[j] + 1;
@@ -201,7 +217,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const {
j++;
}
}
j = starts['^'];
j = starts[static_cast<unsigned int>('^')];
if (j >= 0) {
while (words[j][0] == '^') {
const char *a = words[j] + 1;
@@ -217,3 +233,7 @@ bool WordList::InListAbbreviated(const char *s, const char marker) const {
}
return false;
}
const char *WordList::WordAt(int n) const {
return words[n];
}