Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions testlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ class pattern {
private:
bool matches(const std::string &s, size_t pos) const;

std::string s;
std::string source;
std::vector<pattern> children;
std::vector<char> chars;
int from;
Expand Down Expand Up @@ -1345,7 +1345,7 @@ static int __pattern_greedyMatch(const std::string &s, size_t pos, const std::ve
}

std::string pattern::src() const {
return s;
return source;
}

bool pattern::matches(const std::string &s, size_t pos) const {
Expand Down Expand Up @@ -1528,7 +1528,7 @@ static std::vector<char> __pattern_scanCharSet(const std::string &s, size_t &pos
return result;
}

pattern::pattern(std::string s) : s(s), from(0), to(0) {
pattern::pattern(std::string s) : source(s), from(0), to(0) {
std::string t;
for (size_t i = 0; i < s.length(); i++)
if (!__pattern_isCommandChar(s, i, ' '))
Expand Down Expand Up @@ -1774,7 +1774,7 @@ class FileInputStreamReader : public InputStreamReader {
return EOFC;
}

int getc(FILE *file) {
int getc() {
int c;
int rc;

Expand Down Expand Up @@ -1806,7 +1806,7 @@ class FileInputStreamReader : public InputStreamReader {
}

public:
FileInputStreamReader(std::FILE *file, const std::string &name) : file(file), name(name), line(1) {
FileInputStreamReader(std::FILE *file, const std::string &streamName) : file(file), name(streamName), line(1) {
// No operations.
}

Expand All @@ -1824,7 +1824,7 @@ class FileInputStreamReader : public InputStreamReader {
if (feof(file))
return EOFC;
else {
int c = getc(file);
int c = getc();
ungetc(c/*, file*/);
return postprocessGetc(c);
}
Expand All @@ -1834,11 +1834,11 @@ class FileInputStreamReader : public InputStreamReader {
if (feof(file))
return EOFC;
else
return postprocessGetc(getc(file));
return postprocessGetc(getc());
}

void skipChar() {
getc(file);
getc();
}

void unreadChar(int c) {
Expand Down Expand Up @@ -1920,7 +1920,7 @@ class BufferedFileInputStreamReader : public InputStreamReader {
}

public:
BufferedFileInputStreamReader(std::FILE *file, const std::string &name) : file(file), name(name), line(1) {
BufferedFileInputStreamReader(std::FILE *file, const std::string &streamName) : file(file), name(streamName), line(1) {
buffer = new char[BUFFER_SIZE];
isEof = new bool[BUFFER_SIZE];
bufferSize = MAX_UNREAD_COUNT;
Expand Down Expand Up @@ -2028,9 +2028,9 @@ struct InStream {
size_t maxTokenLength;
size_t maxMessageLength;

void init(std::string fileName, TMode mode);
void init(std::string fileName, TMode contentMode);

void init(std::FILE *f, TMode mode);
void init(std::FILE *f, TMode contentMode);

void setTestCase(int testCase);
std::vector<int> getReadChars();
Expand Down Expand Up @@ -3281,11 +3281,11 @@ void InStream::reset(std::FILE *file) {
}
}

void InStream::init(std::string fileName, TMode mode) {
void InStream::init(std::string fileName, TMode contentMode) {
opened = false;
name = fileName;
stdfile = false;
this->mode = mode;
this->mode = contentMode;

std::ifstream stream;
stream.open(fileName.c_str(), std::ios::in);
Expand All @@ -3305,10 +3305,10 @@ void InStream::init(std::string fileName, TMode mode) {
reset();
}

void InStream::init(std::FILE *f, TMode mode) {
void InStream::init(std::FILE *f, TMode contentMode) {
opened = false;
name = "untitled";
this->mode = mode;
this->mode = contentMode;

if (f == stdin)
name = "stdin", stdfile = true;
Expand Down Expand Up @@ -4642,7 +4642,7 @@ void registerGen(int argc, char *argv[]) {
}
#endif

void setAppesModeEncoding(std::string appesModeEncoding) {
void setAppesModeEncoding(std::string newAppesModeEncoding) {
static const char* const ENCODINGS[] = {"ascii", "utf-7", "utf-8", "utf-16", "utf-16le", "utf-16be", "utf-32", "utf-32le", "utf-32be", "iso-8859-1",
"iso-8859-2", "iso-8859-3", "iso-8859-4", "iso-8859-5", "iso-8859-6", "iso-8859-7", "iso-8859-8", "iso-8859-9", "iso-8859-10", "iso-8859-11",
"iso-8859-13", "iso-8859-14", "iso-8859-15", "iso-8859-16", "windows-1250", "windows-1251", "windows-1252", "windows-1253", "windows-1254", "windows-1255",
Expand All @@ -4654,16 +4654,16 @@ void setAppesModeEncoding(std::string appesModeEncoding) {
"cp1006", "cp775", "cp858", "cp737", "cp853", "cp856", "cp922", "cp1046", "cp1125", "cp1131",
"ptcp154", "koi8-t", "koi8-ru", "mulelao-1", "cp1133", "iso-ir-166", "tcvn", "iso-ir-14", "iso-ir-87", "iso-ir-159"};

appesModeEncoding = lowerCase(appesModeEncoding);
newAppesModeEncoding = lowerCase(newAppesModeEncoding);
bool valid = false;
for (size_t i = 0; i < sizeof(ENCODINGS) / sizeof(ENCODINGS[0]); i++)
if (appesModeEncoding == ENCODINGS[i]) {
if (newAppesModeEncoding == ENCODINGS[i]) {
valid = true;
break;
}
if (!valid)
quit(_fail, "Unexpected encoding for setAppesModeEncoding(encoding)");
::appesModeEncoding = appesModeEncoding;
::appesModeEncoding = newAppesModeEncoding;
}

void registerInteraction(int argc, char *argv[]) {
Expand Down