diff --git a/uppsrc/ide/FormatCode.cpp b/uppsrc/ide/FormatCode.cpp index 804ac7190..69966d8cc 100644 --- a/uppsrc/ide/FormatCode.cpp +++ b/uppsrc/ide/FormatCode.cpp @@ -123,7 +123,7 @@ void Ide::FormatCode() if(sel) Src = editor.GetSelectionW(); else - Src = editor.GetW(); + Src = editor.GetW(); // Instantiate the formatter object ASFormatter Formatter; diff --git a/uppsrc/plugin/astyle/ASBeautifier.cpp b/uppsrc/plugin/astyle/ASBeautifier.cpp index b8a6c1d72..37d6be786 100644 --- a/uppsrc/plugin/astyle/ASBeautifier.cpp +++ b/uppsrc/plugin/astyle/ASBeautifier.cpp @@ -663,14 +663,14 @@ WString ASBeautifier::beautify(const WString &originalLine) bool isInSwitch = false; bool isImmediatelyAfterConst = false; bool isSpecialChar = false; - char ch = ' '; - char prevCh; + wchar ch = ' '; + wchar prevCh; WString outBuffer; // the newly idented line is bufferd here int tabCount = 0; const WString *lastLineHeader = NULL; bool closingBracketReached = false; int spaceTabCount = 0; - char tempCh; + wchar tempCh; int headerStackSize = headerStack->GetCount(); bool shouldIndentBrackettedLine = true; int lineOpeningBlocksNum = 0; @@ -683,7 +683,7 @@ WString ASBeautifier::beautify(const WString &originalLine) blockCommentNoBeautify = blockCommentNoIndent; previousLineProbationTab = false; outLineNumber++; - + // handle and remove white spaces around the line: // If not in comment, first find out size of white space before line, // so that possible comments starting in the line continue in @@ -1814,7 +1814,7 @@ int ASBeautifier::getNextProgramCharDistance(const WString &line, int i) bool inComment = false; int remainingCharNum = line.GetCount() - i; int charDistance; - char ch; + wchar ch; for (charDistance = 1; charDistance < remainingCharNum; charDistance++) { @@ -1870,9 +1870,9 @@ const WString *ASBeautifier::findHeader(const WString &line, int i, const Vector int lineLength = line.GetCount(); int headerEnd = i + header->GetCount(); - char startCh = (*header)[0]; // first char of header - char endCh = 0; // char just after header - char prevCh = 0; // char just before header + wchar startCh = (*header)[0]; // first char of header + wchar endCh = 0; // char just after header + wchar prevCh = 0; // char just before header if (headerEnd < lineLength) { @@ -1960,9 +1960,9 @@ WString ASBeautifier::trim(const WString &str) * @param line the line to check. * @param i the current char position on the line. */ -char ASBeautifier::peekNextChar(WString &line, int i) +wchar ASBeautifier::peekNextChar(WString &line, int i) { - char ch = ' '; + wchar ch = ' '; int peekNum = ASString_Find_First_Not_Of(line, " \t", i + 1); if (peekNum < 0) diff --git a/uppsrc/plugin/astyle/ASEnhancer.cpp b/uppsrc/plugin/astyle/ASEnhancer.cpp index a32dbfe96..c49abeba9 100644 --- a/uppsrc/plugin/astyle/ASEnhancer.cpp +++ b/uppsrc/plugin/astyle/ASEnhancer.cpp @@ -193,7 +193,7 @@ void ASEnhancer::enhance(WString &line) for (int i = 0; i < lineLength; i++) { - char ch = line[i]; + wchar ch = line[i]; // bypass whitespace if (isWhiteSpaceX(ch)) diff --git a/uppsrc/plugin/astyle/ASFormatter.cpp b/uppsrc/plugin/astyle/ASFormatter.cpp index d36ed7d60..c8c1e60cb 100644 --- a/uppsrc/plugin/astyle/ASFormatter.cpp +++ b/uppsrc/plugin/astyle/ASFormatter.cpp @@ -913,7 +913,7 @@ WString ASFormatter::nextLine() if (find(assignmentOperators.begin(), assignmentOperators.end(), newHeader) != assignmentOperators.end()) { - char peekedChar = peekNextChar(); + wchar peekedChar = peekNextChar(); isInPotentialCalculation = (newHeader != &AS_RETURN && !(newHeader == &AS_EQUAL && peekedChar == '*') && !(newHeader == &AS_EQUAL && peekedChar == '&')); @@ -1148,7 +1148,7 @@ void ASFormatter::goForward(int i) * * @return the next unread character. */ -char ASFormatter::peekNextChar() const +wchar ASFormatter::peekNextChar() const { char ch = ' '; int peekNum = ASString_Find_First_Not_Of(currentLine, " \t", charNum + 1); @@ -1321,7 +1321,7 @@ void ASFormatter::trimNewLine() * @param ch the character to append. * @param canBreakLine if true, a registered line-break */ -void ASFormatter::appendChar(char ch, bool canBreakLine) +void ASFormatter::appendChar(wchar ch, bool canBreakLine) { if (canBreakLine && isInLineBreak) breakLine(); @@ -1385,7 +1385,6 @@ void ASFormatter::breakLine() // queue an empty line prepend request if one exists prependEmptyLine = isPrependPostBlockEmptyLineRequested; - readyFormattedLine = formattedLine; if (isAppendPostBlockEmptyLineRequested) { @@ -1466,7 +1465,7 @@ bool ASFormatter::isPointerOrReference() const if (!isPR) { - char nextChar = peekNextChar(); + wchar nextChar = peekNextChar(); isPR |= (!isWhiteSpace(nextChar) && nextChar != '-' && nextChar != '(' @@ -1608,7 +1607,7 @@ const WString *ASFormatter::findHeader(const Vector &headers, bo * * @return true or false */ -bool ASFormatter::lineBeginsWith(char charToCheck) const +bool ASFormatter::lineBeginsWith(wchar charToCheck) const { bool beginsWith = false; int i = ASString_Find_First_Not_Of(currentLine, " \t"); @@ -1866,7 +1865,7 @@ void ASFormatter::padParens(void) } // pad open paren outside - char peekedCharOutside = peekNextChar(); + wchar peekedCharOutside = peekNextChar(); if (shouldPadParensOutside) if (!(currentChar == '(' && peekedCharOutside == ')')) appendSpacePad(); @@ -1889,7 +1888,7 @@ void ASFormatter::padParens(void) } // pad open paren inside - char peekedCharInside = peekNextChar(); + wchar peekedCharInside = peekNextChar(); if (shouldPadParensInside) if (!(currentChar == '(' && peekedCharInside == ')')) appendSpaceAfter(); @@ -1943,7 +1942,7 @@ void ASFormatter::padParens(void) } // pad close paren outside - char peekedCharOutside = peekNextChar(); + wchar peekedCharOutside = peekNextChar(); if (shouldPadParensOutside) if (peekedCharOutside != ';' && peekedCharOutside != ',' @@ -2176,7 +2175,7 @@ void ASFormatter::formatArrayBrackets(BracketType bracketType, bool isOpeningArr appendCurrentChar(); // not the first opening bracket - don't change // if an opening bracket ends the line there will be no inStatement indent - char nextChar = peekNextChar(); + wchar nextChar = peekNextChar(); if (isWhiteSpace(nextChar) || isBeforeLineEndComment(charNum) || nextChar == '{') diff --git a/uppsrc/plugin/astyle/astyle.h b/uppsrc/plugin/astyle/astyle.h index 4de51cca2..b46d00e31 100644 --- a/uppsrc/plugin/astyle/astyle.h +++ b/uppsrc/plugin/astyle/astyle.h @@ -249,21 +249,21 @@ class ASBeautifier : protected ASResource int prevFinalLineSpaceTabCount; int prevFinalLineTabCount; int defineTabCount; - char quoteChar; - char prevNonSpaceCh; - char currentNonSpaceCh; - char currentNonLegalCh; - char prevNonLegalCh; - char peekNextChar(WString &line, int i); + wchar quoteChar; + wchar prevNonSpaceCh; + wchar currentNonSpaceCh; + wchar currentNonLegalCh; + wchar prevNonLegalCh; + wchar peekNextChar(WString &line, int i); protected: // inline functions // check if a specific character can be used in a legal variable/method/class name - inline bool isLegalNameChar(char ch) const { + inline bool isLegalNameChar(wchar ch) const { return (isalnum(ch) || ch == '.' || ch == '_' || (isJavaStyle && ch == '$') || (isCStyle && ch == '~')); } // check if a specific character is a whitespace character - inline bool isWhiteSpace(char ch) const { + inline bool isWhiteSpace(wchar ch) const { return (ch == ' ' || ch == '\t'); } }; @@ -292,7 +292,7 @@ class ASEnhancer int lineNumber; bool isInQuote; bool isInComment; - char quoteChar; + wchar quoteChar; // unindent variables int bracketCount; @@ -325,12 +325,12 @@ class ASEnhancer private: // inline functions // check if a specific character can be used in a legal variable/method/class name - inline bool isLegalNameCharX(char ch) const { + inline bool isLegalNameCharX(wchar ch) const { return (isalnum(ch) || ch == '.' || ch == '_' || (isJavaStyle && ch == '$') || (isCStyle && ch == '~')); } // check if a specific character is a whitespace character - inline bool isWhiteSpaceX(char ch) const { + inline bool isWhiteSpaceX(wchar ch) const { return (ch == ' ' || ch == '\t'); } }; @@ -364,7 +364,7 @@ class ASFormatter : public ASBeautifier, private ASEnhancer void staticInit(); void goForward(int i); void trimNewLine(); - char peekNextChar() const; + wchar peekNextChar() const; BracketType getBracketType() const; bool getNextChar(); bool isBeforeComment() const; @@ -374,8 +374,8 @@ class ASFormatter : public ASBeautifier, private ASEnhancer bool isInExponent() const; bool isOneLineBlockReached() const; // bool isNextCharWhiteSpace() const; - bool lineBeginsWith(char charToCheck) const; - void appendChar(char ch, bool canBreakLine = true); + bool lineBeginsWith(wchar charToCheck) const; + void appendChar(wchar ch, bool canBreakLine = true); void appendCharInsideComments(); void appendSequence(const WString &sequence, bool canBreakLine = true); void appendSpacePad(); @@ -405,11 +405,11 @@ class ASFormatter : public ASBeautifier, private ASEnhancer WString formattedLine; const WString *currentHeader; const WString *previousOperator; // used ONLY by pad=oper - char currentChar; - char previousChar; - char previousNonWSChar; - char previousCommandChar; - char quoteChar; + wchar currentChar; + wchar previousChar; + wchar previousNonWSChar; + wchar previousCommandChar; + wchar quoteChar; int charNum; int spacePadNum; int templateDepth;