diff options
author | Markus Heidelberg <markus.heidelberg@web.de> | 2015-01-11 09:02:54 +1100 |
---|---|---|
committer | Markus Heidelberg <markus.heidelberg@web.de> | 2015-01-11 09:02:54 +1100 |
commit | 4accfda822026b6ca08acba0c81f081fea73a818 (patch) | |
tree | 652ee4d2c32120b10d2dfc4ab0ca39434fb97dc7 | |
parent | 112d049585f555a358cced18c2dd9fd0c90d1a62 (diff) | |
download | scintilla-mirror-4accfda822026b6ca08acba0c81f081fea73a818.tar.gz |
LexHex: move general helper function up and add a prototype
Even if it is only used in the Tektronix lexer.
-rw-r--r-- | lexers/LexHex.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lexers/LexHex.cxx b/lexers/LexHex.cxx index 19c1604c3..db39f7129 100644 --- a/lexers/LexHex.cxx +++ b/lexers/LexHex.cxx @@ -121,6 +121,7 @@ using namespace Scintilla; // prototypes for general helper functions static inline bool IsNewline(const int ch); +static int GetHexaNibble(char hd); static int GetHexaChar(char hd1, char hd2); static int GetHexaChar(unsigned int pos, Accessor &styler); static bool ForwardWithinLine(StyleContext &sc, int nb = 1); @@ -156,6 +157,23 @@ static inline bool IsNewline(const int ch) return (ch == '\n' || ch == '\r'); } +static int GetHexaNibble(char hd) +{ + int hexValue = 0; + + if (hd >= '0' && hd <= '9') { + hexValue += hd - '0'; + } else if (hd >= 'A' && hd <= 'F') { + hexValue += hd - 'A' + 10; + } else if (hd >= 'a' && hd <= 'f') { + hexValue += hd - 'a' + 10; + } else { + return -1; + } + + return hexValue; +} + static int GetHexaChar(char hd1, char hd2) { int hexValue = 0; @@ -535,23 +553,6 @@ static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler) return GetHexaChar(recStartPos+4, styler); } -static int GetHexaNibble(char hd) -{ - int hexValue = 0; - - if (hd >= '0' && hd <= '9') { - hexValue += hd - '0'; - } else if (hd >= 'A' && hd <= 'F') { - hexValue += hd - 'A' + 10; - } else if (hd >= 'a' && hd <= 'f') { - hexValue += hd - 'a' + 10; - } else { - return -1; - } - - return hexValue; -} - // Calculate the checksum of the record (excluding the checksum field). static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler) { |