From 58471e908a3b74b27379bb19a13d62cd8d4476b0 Mon Sep 17 00:00:00 2001 From: Joe Mueller Date: Thu, 30 Jul 2015 14:35:17 +1000 Subject: Use Sci_Position / Sci_PositionU for variables in lexers that represent positions and line numbers and may be widened to 64-bits in a future release. --- lexers/LexA68k.cxx | 2 +- lexers/LexAPDL.cxx | 6 +- lexers/LexASY.cxx | 16 ++--- lexers/LexAU3.cxx | 26 ++++---- lexers/LexAVE.cxx | 8 +-- lexers/LexAVS.cxx | 8 +-- lexers/LexAbaqus.cxx | 46 +++++++------- lexers/LexAda.cxx | 2 +- lexers/LexAsm.cxx | 10 +-- lexers/LexBaan.cxx | 6 +- lexers/LexBash.cxx | 20 +++--- lexers/LexBasic.cxx | 8 +-- lexers/LexBatch.cxx | 24 ++++---- lexers/LexBibTeX.cxx | 8 +-- lexers/LexBullant.cxx | 10 +-- lexers/LexCLW.cxx | 18 +++--- lexers/LexCOBOL.cxx | 26 ++++---- lexers/LexCPP.cxx | 56 ++++++++--------- lexers/LexCSS.cxx | 20 +++--- lexers/LexCaml.cxx | 13 ++-- lexers/LexCmake.cxx | 30 ++++----- lexers/LexCoffeeScript.cxx | 32 +++++----- lexers/LexConf.cxx | 6 +- lexers/LexCrontab.cxx | 6 +- lexers/LexCsound.cxx | 6 +- lexers/LexD.cxx | 10 +-- lexers/LexDMAP.cxx | 16 ++--- lexers/LexDMIS.cxx | 8 +-- lexers/LexDiff.cxx | 14 ++--- lexers/LexECL.cxx | 22 +++---- lexers/LexEScript.cxx | 10 +-- lexers/LexEiffel.cxx | 14 ++--- lexers/LexErlang.cxx | 10 +-- lexers/LexErrorList.cxx | 18 +++--- lexers/LexFlagship.cxx | 10 +-- lexers/LexForth.cxx | 2 +- lexers/LexFortran.cxx | 25 ++++---- lexers/LexGAP.cxx | 14 ++--- lexers/LexGui4Cli.cxx | 13 ++-- lexers/LexHTML.cxx | 72 +++++++++++----------- lexers/LexHaskell.cxx | 34 +++++------ lexers/LexHex.cxx | 148 ++++++++++++++++++++++----------------------- lexers/LexInno.cxx | 14 ++--- lexers/LexKVIrc.cxx | 10 +-- lexers/LexLaTeX.cxx | 65 ++++++++++---------- lexers/LexLisp.cxx | 14 ++--- lexers/LexLout.cxx | 8 +-- lexers/LexLua.cxx | 18 +++--- lexers/LexMPT.cxx | 8 +-- lexers/LexMSSQL.cxx | 20 +++--- lexers/LexMagik.cxx | 10 +-- lexers/LexMake.cxx | 18 +++--- lexers/LexMarkdown.cxx | 24 ++++---- lexers/LexMatlab.cxx | 12 ++-- lexers/LexMetapost.cxx | 14 ++--- lexers/LexModula.cxx | 22 +++---- lexers/LexMySQL.cxx | 10 +-- lexers/LexNimrod.cxx | 38 ++++++------ lexers/LexNsis.cxx | 36 +++++------ lexers/LexOScript.cxx | 32 +++++----- lexers/LexOpal.cxx | 30 ++++----- lexers/LexPB.cxx | 14 ++--- lexers/LexPLM.cxx | 22 +++---- lexers/LexPO.cxx | 16 ++--- lexers/LexPOV.cxx | 10 +-- lexers/LexPS.cxx | 8 +-- lexers/LexPascal.cxx | 50 +++++++-------- lexers/LexPerl.cxx | 70 ++++++++++----------- lexers/LexPowerPro.cxx | 28 ++++----- lexers/LexPowerShell.cxx | 8 +-- lexers/LexProgress.cxx | 6 +- lexers/LexProps.cxx | 22 +++---- lexers/LexPython.cxx | 42 ++++++------- lexers/LexR.cxx | 6 +- lexers/LexRebol.cxx | 8 +-- lexers/LexRegistry.cxx | 34 +++++------ lexers/LexRuby.cxx | 122 ++++++++++++++++++------------------- lexers/LexRust.cxx | 48 +++++++-------- lexers/LexSML.cxx | 11 ++-- lexers/LexSQL.cxx | 30 ++++----- lexers/LexSTTXT.cxx | 38 ++++++------ lexers/LexScriptol.cxx | 24 ++++---- lexers/LexSpecman.cxx | 6 +- lexers/LexSpice.cxx | 2 +- lexers/LexTACL.cxx | 30 ++++----- lexers/LexTADS3.cxx | 18 +++--- lexers/LexTAL.cxx | 30 ++++----- lexers/LexTCL.cxx | 4 +- lexers/LexTCMD.cxx | 28 ++++----- lexers/LexTeX.cxx | 24 ++++---- lexers/LexTxt2tags.cxx | 20 +++--- lexers/LexVB.cxx | 6 +- lexers/LexVHDL.cxx | 48 +++++++-------- lexers/LexVerilog.cxx | 52 ++++++++-------- lexers/LexVisualProlog.cxx | 20 +++--- lexers/LexYAML.cxx | 44 +++++++------- 96 files changed, 1105 insertions(+), 1100 deletions(-) diff --git a/lexers/LexA68k.cxx b/lexers/LexA68k.cxx index c14797238..e74c0b90a 100644 --- a/lexers/LexA68k.cxx +++ b/lexers/LexA68k.cxx @@ -115,7 +115,7 @@ static inline bool IsDoxygenChar (const int ch) * Main function, which colourises a 68k source */ -static void ColouriseA68kDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) +static void ColouriseA68kDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { // Used to buffer a string, to be able to compare it using built-in functions char Buffer[100]; diff --git a/lexers/LexAPDL.cxx b/lexers/LexAPDL.cxx index 8289def08..873ec9d13 100644 --- a/lexers/LexAPDL.cxx +++ b/lexers/LexAPDL.cxx @@ -187,13 +187,13 @@ static int CheckAPDLFoldPoint(char const *token, int &level) { static void FoldAPDLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int line = styler.GetLine(startPos); + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; - int i; + Sci_Position i; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" diff --git a/lexers/LexASY.cxx b/lexers/LexASY.cxx index 722eb2dfa..b49975e70 100644 --- a/lexers/LexASY.cxx +++ b/lexers/LexASY.cxx @@ -152,7 +152,7 @@ static inline bool isASYidentifier(int ch) { ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ; } -static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) +static int ParseASYWord(Sci_PositionU pos, Accessor &styler, char *word) { int length=0; char ch=styler.SafeGetCharAt(pos); @@ -167,11 +167,11 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) return length; } -static bool IsASYDrawingLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; +static bool IsASYDrawingLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - int startpos = pos; + Sci_Position startpos = pos; char buffer[100]=""; while (startpos 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -202,7 +202,7 @@ static void FoldAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyl char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; diff --git a/lexers/LexAU3.cxx b/lexers/LexAU3.cxx index cb3159797..c8ab9d700 100644 --- a/lexers/LexAU3.cxx +++ b/lexers/LexAU3.cxx @@ -170,10 +170,10 @@ static int GetSendKey(const char *szLine, char *szKey) // // Routine to check the last "none comment" character on a line to see if its a continuation // -static bool IsContinuationLine(unsigned int szLine, Accessor &styler) +static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler) { - int nsPos = styler.LineStart(szLine); - int nePos = styler.LineStart(szLine+1) - 2; + Sci_Position nsPos = styler.LineStart(szLine); + Sci_Position nePos = styler.LineStart(szLine+1) - 2; //int stylech = styler.StyleAt(nsPos); while (nsPos < nePos) { @@ -209,8 +209,8 @@ static void ColouriseAU3Doc(Sci_PositionU startPos, WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; // find the first previous line without continuation character at the end - int lineCurrent = styler.GetLine(startPos); - int s_startPos = startPos; + Sci_Position lineCurrent = styler.GetLine(startPos); + Sci_Position s_startPos = startPos; // When not inside a Block comment: find First line without _ if (!(initStyle==SCE_AU3_COMMENTBLOCK)) { while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || @@ -447,7 +447,7 @@ static void ColouriseAU3Doc(Sci_PositionU startPos, { si=0; // at line end and not found a continuation char then reset to default - int lineCurrent = styler.GetLine(sc.currentPos); + Sci_Position lineCurrent = styler.GetLine(sc.currentPos); if (!IsContinuationLine(lineCurrent,styler)) { sc.SetState(SCE_AU3_DEFAULT); @@ -492,7 +492,7 @@ static void ColouriseAU3Doc(Sci_PositionU startPos, else { // check if the start is a valid SendKey start - int nPos = 0; + Sci_Position nPos = 0; int nState = 1; char cTemp; while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) @@ -659,10 +659,10 @@ static bool IsStreamCommentStyle(int style) { // // Routine to find first none space on the current line and return its Style // needed for comment lines not starting on pos 1 -static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) +static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler) { - int nsPos = styler.LineStart(szLine); - int nePos = styler.LineStart(szLine+1) - 1; + Sci_Position nsPos = styler.LineStart(szLine); + Sci_Position nePos = styler.LineStart(szLine+1) - 1; while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos) { nsPos++; // skip to next char @@ -676,14 +676,14 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) // static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int endPos = startPos + length; + Sci_Position endPos = startPos + length; // get settings from the config files for folding comments and preprocessor lines bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldInComment = styler.GetPropertyInt("fold.comment") == 2; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; @@ -720,7 +720,7 @@ static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordLis char chNext = styler.SafeGetCharAt(startPos); char chPrev = ' '; // - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (IsAWordChar(ch)) { diff --git a/lexers/LexAVE.cxx b/lexers/LexAVE.cxx index ee5149318..fd9927379 100644 --- a/lexers/LexAVE.cxx +++ b/lexers/LexAVE.cxx @@ -82,7 +82,7 @@ static void ColouriseAveDoc( for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line - int currentLine = styler.GetLine(sc.currentPos); + Sci_Position currentLine = styler.GetLine(sc.currentPos); styler.SetLineState(currentLine, 0); } if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) { @@ -159,9 +159,9 @@ static void ColouriseAveDoc( static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = static_cast(tolower(styler[startPos])); @@ -169,7 +169,7 @@ static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initS int styleNext = styler.StyleAt(startPos); char s[10] = ""; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = static_cast(tolower(chNext)); chNext = static_cast(tolower(styler.SafeGetCharAt(i + 1))); int style = styleNext; diff --git a/lexers/LexAVS.cxx b/lexers/LexAVS.cxx index 8599ce952..6e0980715 100644 --- a/lexers/LexAVS.cxx +++ b/lexers/LexAVS.cxx @@ -57,7 +57,7 @@ static void ColouriseAvsDoc( WordList &clipProperties = *keywordlists[4]; WordList &userDefined = *keywordlists[5]; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); // Initialize the block comment nesting level, if we are inside such a comment. int blockCommentLevel = 0; if (initStyle == SCE_AVS_COMMENTBLOCK || initStyle == SCE_AVS_COMMENTBLOCKN) { @@ -216,16 +216,16 @@ static void FoldAvsDoc( bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; diff --git a/lexers/LexAbaqus.cxx b/lexers/LexAbaqus.cxx index eba3e59d7..509d89a0a 100644 --- a/lexers/LexAbaqus.cxx +++ b/lexers/LexAbaqus.cxx @@ -301,10 +301,10 @@ static int LowerCase(int c) return c; } -static int LineEnd(int line, Accessor &styler) +static Sci_Position LineEnd(Sci_Position line, Accessor &styler) { - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line - int eol_pos ; + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line + Sci_Position eol_pos ; // if the line is the last line, the eol_pos is styler.Length() // eol will contain a new line, or a virtual new line if ( docLines == line ) @@ -314,7 +314,7 @@ static int LineEnd(int line, Accessor &styler) return eol_pos ; } -static int LineStart(int line, Accessor &styler) +static Sci_Position LineStart(Sci_Position line, Accessor &styler) { return styler.LineStart(line) ; } @@ -330,14 +330,14 @@ static int LineStart(int line, Accessor &styler) // 6 : block close keyword line // 7 : keyword line in error // 8 : comment line -static int LineType(int line, Accessor &styler) { - int pos = LineStart(line, styler) ; - int eol_pos = LineEnd(line, styler) ; +static int LineType(Sci_Position line, Accessor &styler) { + Sci_Position pos = LineStart(line, styler) ; + Sci_Position eol_pos = LineEnd(line, styler) ; int c ; char ch = ' '; - int i = pos ; + Sci_Position i = pos ; while ( i < eol_pos ) { c = styler.SafeGetCharAt(i); ch = static_cast(LowerCase(c)); @@ -418,7 +418,7 @@ static int LineType(int line, Accessor &styler) { return 4 ; } -static void SafeSetLevel(int line, int level, Accessor &styler) +static void SafeSetLevel(Sci_Position line, int level, Accessor &styler) { if ( line < 0 ) return ; @@ -434,18 +434,18 @@ static void SafeSetLevel(int line, int level, Accessor &styler) static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int startLine = styler.GetLine(startPos) ; - int endLine = styler.GetLine(startPos+length-1) ; + Sci_Position startLine = styler.GetLine(startPos) ; + Sci_Position endLine = styler.GetLine(startPos+length-1) ; // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // We want to deal with all the cases // To know the correct indentlevel, we need to look back to the // previous command line indentation level // order of formatting keyline datalines commentlines - int beginData = -1 ; - int beginComment = -1 ; - int prvKeyLine = startLine ; - int prvKeyLineTp = 0 ; + Sci_Position beginData = -1 ; + Sci_Position beginComment = -1 ; + Sci_Position prvKeyLine = startLine ; + Sci_Position prvKeyLineTp = 0 ; // Scan until we find the previous keyword line // this will give us the level reference that we need @@ -467,7 +467,7 @@ WordList *[], Accessor &styler) { prvKeyLine = -1 ; // Now start scanning over the lines. - for ( int line = startLine; line <= endLine; line++ ) { + for ( Sci_Position line = startLine; line <= endLine; line++ ) { int lineType = LineType(line, styler) ; // Check for comment line @@ -516,7 +516,7 @@ WordList *[], Accessor &styler) { datLevel = level ; } - for ( int ll = beginData; ll < beginComment; ll++ ) + for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ; // The keyword we just found is going to be written at another level @@ -532,7 +532,7 @@ WordList *[], Accessor &styler) { } } - for ( int lll = beginComment; lll < line; lll++ ) + for ( Sci_Position lll = beginComment; lll < line; lll++ ) SafeSetLevel(lll, level, styler) ; // wrap and reset @@ -549,10 +549,10 @@ WordList *[], Accessor &styler) { } else { // We need to find out whether this comment block is followed by // a data line or a keyword line - const int docLines = styler.GetLine(styler.Length() - 1); + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); - for ( int line = endLine + 1; line <= docLines; line++ ) { - int lineType = LineType(line, styler) ; + for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) { + Sci_Position lineType = LineType(line, styler) ; if ( lineType != 8 ) { if ( !(lineType & 4) ) { @@ -578,7 +578,7 @@ WordList *[], Accessor &styler) { datLevel = level ; } - for ( int ll = beginData; ll < beginComment; ll++ ) + for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ; if ( prvKeyLineTp == 5 ) { @@ -588,7 +588,7 @@ WordList *[], Accessor &styler) { if ( prvKeyLineTp == 6 ) { level -= 1 ; } - for ( int m = beginComment; m <= endLine; m++ ) + for ( Sci_Position m = beginComment; m <= endLine; m++ ) SafeSetLevel(m, level, styler) ; } diff --git a/lexers/LexAda.cxx b/lexers/LexAda.cxx index e03b75f04..df26d7578 100644 --- a/lexers/LexAda.cxx +++ b/lexers/LexAda.cxx @@ -231,7 +231,7 @@ static void ColouriseDocument( StyleContext sc(startPos, length, initStyle, styler); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; while (sc.More()) { diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx index ded7a4348..0b8e438a8 100644 --- a/lexers/LexAsm.cxx +++ b/lexers/LexAsm.cxx @@ -228,7 +228,7 @@ Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { wordListN = &directives4foldend; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -378,9 +378,9 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -391,7 +391,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int char word[100]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -453,7 +453,7 @@ void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int } lineCurrent++; levelCurrent = levelNext; - if (atEOL && (i == static_cast(styler.Length()-1))) { + if (atEOL && (i == static_cast(styler.Length() - 1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } diff --git a/lexers/LexBaan.cxx b/lexers/LexBaan.cxx index 1421e3797..8da2f3a3e 100644 --- a/lexers/LexBaan.cxx +++ b/lexers/LexBaan.cxx @@ -141,15 +141,15 @@ static void FoldBaanDoc(Sci_PositionU startPos, Sci_Position length, int initSty Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx index 4ce937a80..21c47e577 100644 --- a/lexers/LexBash.cxx +++ b/lexers/LexBash.cxx @@ -223,14 +223,14 @@ static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int in int numBase = 0; int digit; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int cmdState = BASH_CMD_START; int testExprType = 0; // Always backtracks to the start of a line that is not a continuation // of the previous line (i.e. start of a bash command segment) - int ln = styler.GetLine(startPos); - if (ln > 0 && startPos == static_cast(styler.LineStart(ln))) + Sci_Position ln = styler.GetLine(startPos); + if (ln > 0 && startPos == static_cast(styler.LineStart(ln))) ln--; for (;;) { startPos = styler.LineStart(ln); @@ -752,10 +752,10 @@ static void ColouriseBashDoc(Sci_PositionU startPos, Sci_Position length, int in sc.Complete(); } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -769,15 +769,15 @@ static void FoldBashDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; int skipHereCh = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; diff --git a/lexers/LexBasic.cxx b/lexers/LexBasic.cxx index 94d350b42..7fa5b5498 100644 --- a/lexers/LexBasic.cxx +++ b/lexers/LexBasic.cxx @@ -300,7 +300,7 @@ Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { wordListN = &keywordlists[3]; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -478,10 +478,10 @@ void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, in LexAccessor styler(pAccess); - int line = styler.GetLine(startPos); + Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; - int endPos = startPos + length; + Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); @@ -489,7 +489,7 @@ void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, in // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { int c = cNext; cNext = styler.SafeGetCharAt(i + 1); bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n'); diff --git a/lexers/LexBatch.cxx b/lexers/LexBatch.cxx index 551a9b58f..377b2cbf1 100644 --- a/lexers/LexBatch.cxx +++ b/lexers/LexBatch.cxx @@ -35,7 +35,7 @@ static bool IsAlphabetic(int ch) { return IsASCII(ch) && isalpha(ch); } -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } @@ -54,17 +54,17 @@ static bool IsBSeparator(char ch) { static void ColouriseBatchLine( char *lineBuffer, - unsigned int lengthLine, - unsigned int startLine, - unsigned int endPos, + Sci_PositionU lengthLine, + Sci_PositionU startLine, + Sci_PositionU endPos, WordList *keywordlists[], Accessor &styler) { - unsigned int offset = 0; // Line Buffer Offset - unsigned int cmdLoc; // External Command / Program Location + Sci_PositionU offset = 0; // Line Buffer Offset + Sci_PositionU cmdLoc; // External Command / Program Location char wordBuffer[81]; // Word Buffer - large to catch long paths - unsigned int wbl; // Word Buffer Length - unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length + Sci_PositionU wbl; // Word Buffer Length + Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length WordList &keywords = *keywordlists[0]; // Internal Commands WordList &keywords2 = *keywordlists[1]; // External Commands (optional) @@ -219,7 +219,7 @@ static void ColouriseBatchLine( // Affected Commands are in Length range 2-6 // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected sKeywordFound = false; - for (unsigned int keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { + for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { wbo = 0; // Copy Keyword Length from Word Buffer into Special Keyword Buffer for (; wbo < keywordLength; wbo++) { @@ -472,9 +472,9 @@ static void ColouriseBatchDoc( styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; - unsigned int startLine = startPos; - for (unsigned int i = startPos; i < startPos + length; i++) { + Sci_PositionU linePos = 0; + Sci_PositionU startLine = startPos; + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it diff --git a/lexers/LexBibTeX.cxx b/lexers/LexBibTeX.cxx index bab02842a..fef58a9b0 100644 --- a/lexers/LexBibTeX.cxx +++ b/lexers/LexBibTeX.cxx @@ -94,7 +94,7 @@ namespace { styler.StartAt(start_pos); styler.StartSegment(start_pos); - int current_line = styler.GetLine(start_pos); + Sci_Position current_line = styler.GetLine(start_pos); int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK; int current_level = prev_level; int visible_chars = 0; @@ -153,7 +153,7 @@ namespace { sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the = sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization - int start = sc.currentPos; + Sci_Position start = sc.currentPos; // We need to handle multiple situations: // 1. name"one two {three}" @@ -227,12 +227,12 @@ namespace { state = SCE_BIBTEX_DEFAULT; } - int end = sc.currentPos; + Sci_Position end = sc.currentPos; current_line = styler.GetLine(end); // We have possibly skipped some lines, so the folding levels // have to be adjusted separately - for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i) + for (Sci_Position i = styler.GetLine(start); i <= styler.GetLine(end); ++i) styler.SetLevel(i, prev_level); sc.ForwardSetState(state); diff --git a/lexers/LexBullant.cxx b/lexers/LexBullant.cxx index 8a3dbb46d..404188769 100644 --- a/lexers/LexBullant.cxx +++ b/lexers/LexBullant.cxx @@ -23,10 +23,10 @@ using namespace Scintilla; #endif -static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static int classifyWordBullant(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char s[100]; s[0] = '\0'; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { + for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { s[i] = static_cast(tolower(styler[start + i])); s[i + 1] = '\0'; } @@ -65,7 +65,7 @@ static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int styler.StartAt(startPos); bool fold = styler.GetPropertyInt("fold") != 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; @@ -74,11 +74,11 @@ static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; styler.StartSegment(startPos); int endFoundThisLine = 0; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexCLW.cxx b/lexers/LexCLW.cxx index 0e7242761..af2ca151a 100644 --- a/lexers/LexCLW.cxx +++ b/lexers/LexCLW.cxx @@ -142,12 +142,12 @@ inline bool SetNumericConstantState(StyleContext &scDoc) { } // Get the next word in uppercase from the current position (keyword lookahead) -inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) { +inline bool GetNextWordUpper(Accessor &styler, Sci_PositionU uiStartPos, Sci_Position iLength, char *cWord) { - unsigned int iIndex = 0; // Buffer Index + Sci_PositionU iIndex = 0; // Buffer Index // Loop through the remaining string from the current position - for (int iOffset = uiStartPos; iOffset < iLength; iOffset++) { + for (Sci_Position iOffset = uiStartPos; iOffset < iLength; iOffset++) { // Get the character from the buffer using the offset char cCharacter = styler[iOffset]; if (IsEOL(cCharacter)) { @@ -534,9 +534,9 @@ static void ColouriseClarionDocInsensitive(Sci_PositionU uiStartPos, Sci_Positio // Fill Buffer -static void FillBuffer(unsigned int uiStart, unsigned int uiEnd, Accessor &accStyler, char *szBuffer, unsigned int uiLength) { +static void FillBuffer(Sci_PositionU uiStart, Sci_PositionU uiEnd, Accessor &accStyler, char *szBuffer, Sci_PositionU uiLength) { - unsigned int uiPos = 0; + Sci_PositionU uiPos = 0; while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) { szBuffer[uiPos] = static_cast(toupper(accStyler[uiStart + uiPos])); @@ -601,17 +601,17 @@ static int ClassifyClarionFoldPoint(int iLevel, const char* szString) { // Clarion Language Folding Procedure static void FoldClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *[], Accessor &accStyler) { - unsigned int uiEndPos = uiStartPos + iLength; - int iLineCurrent = accStyler.GetLine(uiStartPos); + Sci_PositionU uiEndPos = uiStartPos + iLength; + Sci_Position iLineCurrent = accStyler.GetLine(uiStartPos); int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK; int iLevelCurrent = iLevelPrev; char chNext = accStyler[uiStartPos]; int iStyle = iInitStyle; int iStyleNext = accStyler.StyleAt(uiStartPos); int iVisibleChars = 0; - int iLastStart = 0; + Sci_Position iLastStart = 0; - for (unsigned int uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) { + for (Sci_PositionU uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) { char chChar = chNext; chNext = accStyler.SafeGetCharAt(uiPos + 1); diff --git a/lexers/LexCOBOL.cxx b/lexers/LexCOBOL.cxx index bce06623a..3150e3338 100644 --- a/lexers/LexCOBOL.cxx +++ b/lexers/LexCOBOL.cxx @@ -64,12 +64,12 @@ static int CountBits(int nBits) return count; } -static void getRange(unsigned int start, - unsigned int end, +static void getRange(Sci_PositionU start, + Sci_PositionU end, Accessor &styler, char *s, - unsigned int len) { - unsigned int i = 0; + Sci_PositionU len) { + Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(tolower(styler[start + i])); i++; @@ -77,12 +77,12 @@ static void getRange(unsigned int start, s[i] = '\0'; } -static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) { +static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) { styler.ColourTo(end, attr); } -static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { +static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { int ret = 0; WordList& a_keywords = *keywordlists[0]; @@ -152,11 +152,11 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int nContainment; - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); nContainment = styler.GetLineState(currentLine); @@ -170,7 +170,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i bool bNewLine = true; bool bAarea = !isspacechar(chNext); int column = 0; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -277,7 +277,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i if (ch == '\r' || ch == '\n') { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast(startPos))))) { + (styler.GetStartSegment() == static_cast(startPos))))) { ColourTo(styler, i, state); state = SCE_C_DEFAULT; } @@ -312,9 +312,9 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; char chNext = styler[startPos]; @@ -322,7 +322,7 @@ static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordL bool bAarea = !isspacechar(chNext); int column = 0; bool bComment = false; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); ++column; diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index da558b357..628672b9e 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -54,7 +54,7 @@ bool IsSpaceEquiv(int state) { // Putting a space between the '++' post-inc operator and the '+' binary op // fixes this, and is highly recommended for readability anyway. bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { - int pos = (int) sc.currentPos; + Sci_Position pos = (Sci_Position) sc.currentPos; while (--pos > 0) { char ch = styler[pos]; if (ch == '+' || ch == '-') { @@ -66,9 +66,9 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) { bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { // Don't look at styles, so no need to flush. - int pos = (int) sc.currentPos; - int currentLine = styler.GetLine(pos); - int lineStartPos = styler.LineStart(currentLine); + Sci_Position pos = (Sci_Position) sc.currentPos; + Sci_Position currentLine = styler.GetLine(pos); + Sci_Position lineStartPos = styler.LineStart(currentLine); while (--pos > lineStartPos) { char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { @@ -145,7 +145,7 @@ void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { const int lengthMarker = 50; char marker[lengthMarker+1]; - int currPos = (int) sc.currentPos; + Sci_Position currPos = (Sci_Position) sc.currentPos; int i = 0; while (i < lengthMarker) { char ch = styler.SafeGetCharAt(currPos + i); @@ -199,11 +199,11 @@ struct EscapeSequence { } }; -std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) { +std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { std::string restOfLine; - int i =0; + Sci_Position i =0; char ch = styler.SafeGetCharAt(start, '\n'); - int endLine = styler.LineEnd(styler.GetLine(start)); + Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); while (((start+i) < endLine) && (ch != '\r')) { char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); if (ch == '/' && (chNext == '/' || chNext == '*')) @@ -224,12 +224,12 @@ bool IsStreamCommentStyle(int style) { } struct PPDefinition { - int line; + Sci_Position line; std::string key; std::string value; bool isUndef; std::string arguments; - PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : + PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { } }; @@ -285,14 +285,14 @@ public: class PPStates { std::vector vlls; public: - LinePPState ForLine(int line) const { + LinePPState ForLine(Sci_Position line) const { if ((line > 0) && (vlls.size() > static_cast(line))) { return vlls[line]; } else { return LinePPState(); } } - void Add(int line, LinePPState lls) { + void Add(Sci_Position line, LinePPState lls) { vlls.resize(line+1); vlls[line] = lls; } @@ -590,7 +590,7 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { wordListN = &markerList; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -630,8 +630,8 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { // Functor used to truncate history struct After { - int line; - explicit After(int line_) : line(line_) {} + Sci_Position line; + explicit After(Sci_Position line_) : line(line_) {} bool operator()(PPDefinition &p) const { return p.line > line; } @@ -664,13 +664,13 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i bool inRERange = false; bool seenDocKeyBrace = false; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || (MaskActive(initStyle) == SCE_C_COMMENTLINE) || (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) { // Set continuationLine if last character of previous line is '\' if (lineCurrent > 0) { - int endLinePrevious = styler.LineEnd(lineCurrent - 1); + Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1); if (endLinePrevious > 0) { continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; } @@ -679,7 +679,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { - int back = startPos; + Sci_Position back = startPos; while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back)))) ; if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) { @@ -719,7 +719,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD); - int lineEndNext = styler.LineEnd(lineCurrent); + Sci_Position lineEndNext = styler.LineEnd(lineCurrent); for (; sc.More();) { @@ -757,7 +757,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i // Handle line continuation generically. if (sc.ch == '\\') { - if (static_cast((sc.currentPos+1)) >= lineEndNext) { + if (static_cast((sc.currentPos+1)) >= lineEndNext) { lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); @@ -1026,7 +1026,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\\' && (static_cast(sc.currentPos+1) < lineEndNext)) { + } else if (sc.ch == '\\' && (static_cast(sc.currentPos+1) < lineEndNext)) { // Gobble up the escaped character sc.Forward(); } else if (sc.ch == '[') { @@ -1132,7 +1132,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) { sc.SetState(SCE_C_STRINGRAW|activitySet); rawStringTerminator = ")"; - for (int termPos = sc.currentPos + 1;; termPos++) { + for (Sci_Position termPos = sc.currentPos + 1;; termPos++) { char chTerminator = styler.SafeGetCharAt(termPos, '('); if (chTerminator == '(') break; @@ -1286,21 +1286,21 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; bool inLineComment = false; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - unsigned int lineStartNext = styler.LineStart(lineCurrent+1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = MaskActive(styler.StyleAt(startPos)); int style = MaskActive(initStyle); const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -1337,7 +1337,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int } if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -1379,7 +1379,7 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast(styler.Length()-1))) { + if (atEOL && (i == static_cast(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } diff --git a/lexers/LexCSS.cxx b/lexers/LexCSS.cxx index b56aff31b..19345af54 100644 --- a/lexers/LexCSS.cxx +++ b/lexers/LexCSS.cxx @@ -58,11 +58,11 @@ inline bool IsCssOperator(const int ch) { } // look behind (from start of document to our start position) to determine current nesting level -inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) { +inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) { int ch; int nestingLevel = 0; - for (unsigned int i = 0; i < startPos; i++) { + for (Sci_PositionU i = 0; i < startPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == '{') nestingLevel++; @@ -131,7 +131,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini if (lastStateC == -1) { // backtrack to get last state: // comments are like whitespace, so we must return to the previous state - unsigned int i = startPos; + Sci_PositionU i = startPos; for (; i > 0; i--) { if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { if (lastStateC == SCE_CSS_OPERATOR) { @@ -165,7 +165,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) continue; - unsigned int i = sc.currentPos; + Sci_PositionU i = sc.currentPos; while (i && styler[i-1] == '\\') i--; if ((sc.currentPos - i) % 2 == 1) @@ -175,7 +175,7 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini if (sc.state == SCE_CSS_OPERATOR) { if (op == ' ') { - unsigned int i = startPos; + Sci_PositionU i = startPos; op = styler.SafeGetCharAt(i-1); opPrev = styler.SafeGetCharAt(i-2); while (--i) { @@ -380,10 +380,10 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini // check for nested rule selector if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) { // look ahead to see whether { comes before next ; and } - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int ch; - for (unsigned int i = sc.currentPos; i < endPos; i++) { + for (Sci_PositionU i = sc.currentPos; i < endPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == ';' || ch == '}') break; @@ -505,14 +505,14 @@ static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int ini static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); diff --git a/lexers/LexCaml.cxx b/lexers/LexCaml.cxx index 4cc0bd7df..df8781541 100644 --- a/lexers/LexCaml.cxx +++ b/lexers/LexCaml.cxx @@ -188,7 +188,8 @@ void ColouriseCamlDoc( // initialize styler StyleContext sc(startPos, length, initStyle, styler); - int chBase = 0, chToken = 0, chLit = 0; + Sci_PositionU chToken = 0; + int chBase = 0, chLit = 0; WordList& keywords = *keywordlists[0]; WordList& keywords2 = *keywordlists[1]; WordList& keywords3 = *keywordlists[2]; @@ -206,7 +207,7 @@ void ColouriseCamlDoc( while (sc.More()) { // set up [per-char] state info int state2 = -1; // (ASSUME no state change) - int chColor = sc.currentPos - 1;// (ASSUME standard coloring range) + Sci_Position chColor = sc.currentPos - 1;// (ASSUME standard coloring range) bool advance = true; // (ASSUME scanner "eats" 1 char) // step state machine @@ -254,11 +255,11 @@ void ColouriseCamlDoc( case SCE_CAML_IDENTIFIER: // [try to] interpret as [additional] identifier char if (!(iscaml(sc.ch) || sc.Match('\''))) { - const int n = sc.currentPos - chToken; + const Sci_Position n = sc.currentPos - chToken; if (n < 24) { // length is believable as keyword, [re-]construct token char t[24]; - for (int i = -n; i < 0; i++) + for (Sci_Position i = -n; i < 0; i++) t[n + i] = static_cast(sc.GetRelative(i)); t[n] = '\0'; // special-case "_" token as KEYWORD @@ -390,7 +391,7 @@ void ColouriseCamlDoc( state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++, styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush(); // ... then backtrack to determine original SML literal type - int p = chColor - 2; + Sci_Position p = chColor - 2; for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ; if (p >= 0) state2 = static_cast(styler.StyleAt(p)); @@ -437,7 +438,7 @@ void ColouriseCamlDoc( static #endif /* BUILD_AS_EXTERNAL_LEXER */ void FoldCamlDoc( - unsigned int, int, + Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) diff --git a/lexers/LexCmake.cxx b/lexers/LexCmake.cxx index 4bfc5adb0..1cbca3611 100644 --- a/lexers/LexCmake.cxx +++ b/lexers/LexCmake.cxx @@ -43,10 +43,10 @@ static bool isCmakeLetter(char ch) return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } -static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) +static bool CmakeNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { - int nNextLine = -1; - for ( unsigned int i = start; i < end; i++ ) { + Sci_Position nNextLine = -1; + for ( Sci_PositionU i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if ( cNext == '\n' ) { nNextLine = i+1; @@ -57,7 +57,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor if ( nNextLine == -1 ) // We never foudn the next line... return false; - for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { + for ( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if ( cNext == ' ' ) continue; @@ -71,7 +71,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor return false; } -static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) +static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse) { // If the word is too long, it is not what we are looking for if ( end - start > 20 ) @@ -100,7 +100,7 @@ static int calculateFoldCmake(unsigned int start, unsigned int end, int foldleve return newFoldlevel; } -static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) +static int classifyWordCmake(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler ) { char word[100] = {0}; char lowercaseWord[100] = {0}; @@ -109,7 +109,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key WordList &Parameters = *keywordLists[1]; WordList &UserDefined = *keywordLists[2]; - for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { + for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) { word[i] = static_cast( styler[ start + i ] ); lowercaseWord[i] = static_cast(tolower(word[i])); } @@ -171,14 +171,14 @@ static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, styler.StartAt( startPos ); styler.GetLine( startPos ); - unsigned int nLengthDoc = startPos + length; + Sci_PositionU nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; - unsigned int i; + Sci_PositionU i; for ( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); char cNextChar = styler.SafeGetCharAt(i+1); @@ -263,8 +263,8 @@ static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, } if ( cNextChar == '\r' || cNextChar == '\n' ) { - int nCurLine = styler.GetLine(i+1); - int nBack = i; + Sci_Position nCurLine = styler.GetLine(i+1); + Sci_Position nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; @@ -385,18 +385,18 @@ static void FoldCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordL bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; - int lineCurrent = styler.GetLine(startPos); - unsigned int safeStartPos = styler.LineStart( lineCurrent ); + Sci_Position lineCurrent = styler.GetLine(startPos); + Sci_PositionU safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; - int nWordStart = -1; + Sci_Position nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; - for (unsigned int i = safeStartPos; i < startPos + length; i++) { + for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); if ( bArg1 ) { diff --git a/lexers/LexCoffeeScript.cxx b/lexers/LexCoffeeScript.cxx index 0cd86e838..34ad716e9 100644 --- a/lexers/LexCoffeeScript.cxx +++ b/lexers/LexCoffeeScript.cxx @@ -48,7 +48,7 @@ static bool IsSpaceEquiv(int state) { // Putting a space between the '++' post-inc operator and the '+' binary op // fixes this, and is highly recommended for readability anyway. static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { - int pos = (int) sc.currentPos; + Sci_Position pos = (Sci_Position) sc.currentPos; while (--pos > 0) { char ch = styler[pos]; if (ch == '+' || ch == '-') { @@ -60,9 +60,9 @@ static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) { // Don't look at styles, so no need to flush. - int pos = (int) sc.currentPos; - int currentLine = styler.GetLine(pos); - int lineStartPos = styler.LineStart(currentLine); + Sci_Position pos = (Sci_Position) sc.currentPos; + Sci_Position currentLine = styler.GetLine(pos); + Sci_Position lineStartPos = styler.LineStart(currentLine); while (--pos > lineStartPos) { char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { @@ -97,9 +97,9 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length int visibleChars = 0; // look back to set chPrevNonWhite properly for better regex colouring - int endPos = startPos + length; + Sci_Position endPos = startPos + length; if (startPos > 0 && IsSpaceEquiv(initStyle)) { - unsigned int back = startPos; + Sci_PositionU back = startPos; styler.Flush(); while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back))) ; @@ -268,10 +268,10 @@ static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length sc.Complete(); } -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { +static bool IsCommentLine(Sci_Position line, Accessor &styler) { + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; + for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; @@ -284,9 +284,9 @@ static bool IsCommentLine(int line, Accessor &styler) { static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { // A simplified version of FoldPyDoc - const int maxPos = startPos + length; - const int maxLines = styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length() - 1); // Available last line + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line + const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line // property fold.coffeescript.comment const bool foldComment = styler.GetPropertyInt("fold.coffeescript.comment") != 0; @@ -298,7 +298,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; @@ -321,7 +321,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int // Gather info int lev = indentCurrent; - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; if (lineNext <= docLines) { // Information about next line is only available if not at end of document @@ -365,7 +365,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { diff --git a/lexers/LexConf.cxx b/lexers/LexConf.cxx index f41e623cc..2eed51b71 100644 --- a/lexers/LexConf.cxx +++ b/lexers/LexConf.cxx @@ -35,10 +35,10 @@ static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, W { int state = SCE_CONF_DEFAULT; char chNext = styler[startPos]; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... char *buffer = new char[length+1]; - int bufferCount = 0; + Sci_Position bufferCount = 0; // this assumes that we have 2 keyword list in conf.properties WordList &directives = *keywordLists[0]; @@ -48,7 +48,7 @@ static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, W // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexCrontab.cxx b/lexers/LexCrontab.cxx index 3bc20f11f..b500d2d28 100644 --- a/lexers/LexCrontab.cxx +++ b/lexers/LexCrontab.cxx @@ -34,10 +34,10 @@ static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, i { int state = SCE_NNCRONTAB_DEFAULT; char chNext = styler[startPos]; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... char *buffer = new char[length+1]; - int bufferCount = 0; + Sci_Position bufferCount = 0; // used when highliting environment variables inside quoted string: bool insideString = false; @@ -50,7 +50,7 @@ static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, i // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexCsound.cxx b/lexers/LexCsound.cxx index 292eb15c7..6d065c8d1 100644 --- a/lexers/LexCsound.cxx +++ b/lexers/LexCsound.cxx @@ -152,15 +152,15 @@ static void ColouriseCsoundDoc(Sci_PositionU startPos, Sci_Position length, int static void FoldCsoundInstruments(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int stylePrev = 0; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; diff --git a/lexers/LexD.cxx b/lexers/LexD.cxx index 4d699da61..7c0177e99 100644 --- a/lexers/LexD.cxx +++ b/lexers/LexD.cxx @@ -229,7 +229,7 @@ Sci_Position SCI_METHOD LexerD::WordListSet(int n, const char *wl) { wordListN = &keywords7; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -248,7 +248,7 @@ void SCI_METHOD LexerD::Lex(Sci_PositionU startPos, Sci_Position length, int ini StyleContext sc(startPos, length, initStyle, styler); - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; bool numFloat = false; // Float literals have '+' and '-' signs bool numHex = false; @@ -478,9 +478,9 @@ void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int in LexAccessor styler(pAccess); - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -491,7 +491,7 @@ void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int in int style = initStyle; bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; diff --git a/lexers/LexDMAP.cxx b/lexers/LexDMAP.cxx index 8f3706b77..eb43cde6d 100644 --- a/lexers/LexDMAP.cxx +++ b/lexers/LexDMAP.cxx @@ -44,8 +44,8 @@ static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int in WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ - int posLineStart = 0, numNonBlank = 0; - int endPos = startPos + length; + Sci_Position posLineStart = 0, numNonBlank = 0; + Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) { @@ -65,7 +65,7 @@ static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int in if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle data appearing after column 72; it is ignored - int toLineStart = sc.currentPos - posLineStart; + Sci_Position toLineStart = sc.currentPos - posLineStart; if (toLineStart >= 72 || sc.ch == '$') { sc.SetState(SCE_DMAP_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end @@ -158,19 +158,19 @@ static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initSty // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; /***************************************/ - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -186,7 +186,7 @@ static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initSty if (style == SCE_DMAP_WORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; - unsigned int k; + Sci_PositionU k; for(k=0; (k<31 ) && (k(tolower(styler[lastStart+k])); } diff --git a/lexers/LexDMIS.cxx b/lexers/LexDMIS.cxx index 39d40b6cc..7eeecca0e 100644 --- a/lexers/LexDMIS.cxx +++ b/lexers/LexDMIS.cxx @@ -187,7 +187,7 @@ const char * SCI_METHOD LexerDMIS::DescribeWordListSets() void SCI_METHOD LexerDMIS::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - const unsigned int MAX_STR_LEN = 100; + const Sci_PositionU MAX_STR_LEN = 100; LexAccessor styler(pAccess); StyleContext scCTX(startPos, lengthDoc, initStyle, styler); @@ -286,9 +286,9 @@ void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, const int MAX_STR_LEN = 100; LexAccessor styler(pAccess); - unsigned int endPos = startPos + lengthDoc; + Sci_PositionU endPos = startPos + lengthDoc; char chNext = styler[startPos]; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int strPos = 0; @@ -300,7 +300,7 @@ void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, tmpStr = new char[MAX_STR_LEN]; memset(tmpStr, 0, MAX_STR_LEN*sizeof(char)); - for (unsigned int i=startPos; i 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE; int nextLevel; @@ -143,7 +143,7 @@ static void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi prevLevel = nextLevel; curLineStart = styler.LineStart(++curLine); - } while (static_cast(startPos) + length > curLineStart); + } while (static_cast(startPos)+length > curLineStart); } static const char *const emptyWordListDesc[] = { diff --git a/lexers/LexECL.cxx b/lexers/LexECL.cxx index 9f47b01a0..32dc09b43 100644 --- a/lexers/LexECL.cxx +++ b/lexers/LexECL.cxx @@ -90,7 +90,7 @@ static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int ini if (initStyle == SCE_ECL_PREPROCESSOR) { // Set continuationLine if last character of previous line is '\' - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { int chBack = styler.SafeGetCharAt(startPos-1, 0); int chBack2 = styler.SafeGetCharAt(startPos-2, 0); @@ -106,7 +106,7 @@ static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int ini // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { - int back = startPos; + Sci_Position back = startPos; while (--back && IsSpaceEquiv(styler.StyleAt(back))) ; if (styler.StyleAt(back) == SCE_ECL_OPERATOR) { @@ -311,7 +311,7 @@ static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int ini } // Determine if a new state should be entered. - int lineCurrent = styler.GetLine(sc.currentPos); + Sci_Position lineCurrent = styler.GetLine(sc.currentPos); int lineState = styler.GetLineState(lineCurrent); if (sc.state == SCE_ECL_DEFAULT) { if (lineState) { @@ -388,8 +388,8 @@ static bool IsStreamCommentStyle(int style) { style == SCE_ECL_COMMENTDOCKEYWORDERROR; } -bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) { - int i=0; +bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) { + Sci_Position i=0; for (; *s; i++) { char compare_char = tolower(*s); char styler_char = tolower(styler.SafeGetCharAt(pos+i)); @@ -405,15 +405,15 @@ bool MatchNoCase(Accessor & styler, unsigned int & pos, const char *s) { // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". -static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, +static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = true; bool foldPreprocessor = true; bool foldCompact = true; bool foldAtElse = true; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; @@ -422,7 +422,7 @@ static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyl char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -449,7 +449,7 @@ static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyl } if (foldPreprocessor && (style == SCE_ECL_PREPROCESSOR)) { if (ch == '#') { - unsigned int j = i + 1; + Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -497,7 +497,7 @@ static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyl lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast(styler.Length()-1))) { + if (atEOL && (i == static_cast(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } diff --git a/lexers/LexEScript.cxx b/lexers/LexEScript.cxx index 60fd31da9..bc1fb3201 100644 --- a/lexers/LexEScript.cxx +++ b/lexers/LexEScript.cxx @@ -181,19 +181,19 @@ static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int init // Do not know how to fold the comment at the moment. bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldComment = true; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; @@ -231,7 +231,7 @@ static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int init if (style == SCE_ESCRIPT_WORD3) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; - unsigned int j; + Sci_PositionU j; for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) { s[j] = static_cast(tolower(styler[lastStart + j])); } diff --git a/lexers/LexEiffel.cxx b/lexers/LexEiffel.cxx index 94ebab35b..2e2813ef6 100644 --- a/lexers/LexEiffel.cxx +++ b/lexers/LexEiffel.cxx @@ -124,10 +124,10 @@ static bool IsEiffelComment(Accessor &styler, Sci_Position pos, Sci_Position len static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; @@ -137,7 +137,7 @@ static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment); char chNext = styler[startPos]; - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -166,9 +166,9 @@ static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -177,7 +177,7 @@ static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, i // lastDeferred should be determined by looking back to last keyword in case // the "deferred" is on a line before "class" bool lastDeferred = false; - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; @@ -185,7 +185,7 @@ static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, i bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) { char s[20]; - unsigned int j = 0; + Sci_PositionU j = 0; while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { s[j] = styler[i + j]; j++; diff --git a/lexers/LexErlang.cxx b/lexers/LexErlang.cxx index b4dd6e484..3d3c1e89f 100644 --- a/lexers/LexErlang.cxx +++ b/lexers/LexErlang.cxx @@ -500,7 +500,7 @@ static void ColouriseErlangDoc(Sci_PositionU startPos, Sci_Position length, int static int ClassifyErlangFoldPoint( Accessor &styler, int styleNext, - int keyword_start + Sci_Position keyword_start ) { int lev = 0; if (styler.Match(keyword_start,"case") @@ -524,20 +524,20 @@ static void FoldErlangDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** /*keywordlists*/, Accessor &styler ) { - unsigned int endPos = startPos + length; - int currentLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position currentLine = styler.GetLine(startPos); int lev; int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK; int currentLevel = previousLevel; int styleNext = styler.StyleAt(startPos); int style = initStyle; int stylePrev; - int keyword_start = 0; + Sci_Position keyword_start = 0; char ch; char chNext = styler.SafeGetCharAt(startPos); bool atEOL; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx index 50fbfdc6e..be85cdc8f 100644 --- a/lexers/LexErrorList.cxx +++ b/lexers/LexErrorList.cxx @@ -43,12 +43,12 @@ static bool IsAlphabetic(int ch) { return IsASCII(ch) && isalpha(ch); } -static inline bool AtEOL(Accessor &styler, unsigned int i) { +static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } -static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) { +static int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) { if (lineBuffer[0] == '>') { // Command or return status return SCE_ERR_CMD; @@ -146,7 +146,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags, stUnrecognized } state = stInitial; - for (unsigned int i = 0; i < lengthLine; i++) { + for (Sci_PositionU i = 0; i < lengthLine; i++) { char ch = lineBuffer[i]; char chNext = ' '; if ((i + 1) < lengthLine) @@ -203,7 +203,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) { // Possibly Delphi.. don't test against chNext as it's one of the strings below. char word[512]; - unsigned int j, chPos; + Sci_PositionU j, chPos; unsigned numstep; chPos = 0; if (ch == ' ') @@ -261,11 +261,11 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin static void ColouriseErrorListLine( char *lineBuffer, - unsigned int lengthLine, - unsigned int endPos, + Sci_PositionU lengthLine, + Sci_PositionU endPos, Accessor &styler, bool valueSeparate) { - int startValue = -1; + Sci_Position startValue = -1; int style = RecogniseErrorListLine(lineBuffer, lengthLine, startValue); if (valueSeparate && (startValue >= 0)) { styler.ColourTo(endPos - (lengthLine - startValue), style); @@ -279,7 +279,7 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i char lineBuffer[10000]; styler.StartAt(startPos); styler.StartSegment(startPos); - unsigned int linePos = 0; + Sci_PositionU linePos = 0; // property lexer.errorlist.value.separate // For lines in the output pane that are matches from Find in Files or GCC-style @@ -287,7 +287,7 @@ static void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, i // line with style 21 used for the rest of the line. // This allows matched text to be more easily distinguished from its location. bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; - for (unsigned int i = startPos; i < startPos + length; i++) { + for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it diff --git a/lexers/LexFlagship.cxx b/lexers/LexFlagship.cxx index b355423e5..6f6f4c0c7 100644 --- a/lexers/LexFlagship.cxx +++ b/lexers/LexFlagship.cxx @@ -271,9 +271,9 @@ static void ColouriseFlagShipDoc(Sci_PositionU startPos, Sci_Position length, in } } } else if (bEnableCode && sc.ch == '{') { - int p = 0; + Sci_Position p = 0; int chSeek; - unsigned int endPos(startPos + length); + Sci_PositionU endPos(startPos + length); do { // Skip whitespace chSeek = sc.GetRelative(++p); } while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos)); @@ -306,10 +306,10 @@ static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - int endPos = startPos + length; + Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0 && lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); @@ -317,7 +317,7 @@ static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int, int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); char chNext = styler[startPos]; - for (int i = startPos; i < endPos; i++) { + for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); diff --git a/lexers/LexForth.cxx b/lexers/LexForth.cxx index 9e9c3b540..63d3f4f6d 100644 --- a/lexers/LexForth.cxx +++ b/lexers/LexForth.cxx @@ -151,7 +151,7 @@ static void ColouriseForthDoc(Sci_PositionU startPos, Sci_Position length, int i sc.Complete(); } -static void FoldForthDoc(unsigned int, int, int, WordList *[], +static void FoldForthDoc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) { } diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx index 4acf2d7f3..37e0b45c5 100644 --- a/lexers/LexFortran.cxx +++ b/lexers/LexFortran.cxx @@ -46,7 +46,7 @@ static inline bool IsALineEnd(char ch) { return ((ch == '\n') || (ch == '\r')) ; } /***************************************/ -static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { +static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) { while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue; if (styler.SafeGetCharAt(pos) == '\n') pos++; while (IsABlank(styler.SafeGetCharAt(pos++))) continue; @@ -65,8 +65,9 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ - int posLineStart = 0, numNonBlank = 0, prevState = 0; - int endPos = startPos + length; + Sci_Position posLineStart = 0; + int numNonBlank = 0, prevState = 0; + Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) { @@ -86,7 +87,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle the fix format generically - int toLineStart = sc.currentPos - posLineStart; + Sci_Position toLineStart = sc.currentPos - posLineStart; if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) { if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') { if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || @@ -130,7 +131,7 @@ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int // Handle line continuation generically. if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) { char chTemp = ' '; - int j = 1; + Sci_Position j = 1; while (IsABlank(chTemp) && j<132) { chTemp = static_cast(sc.GetRelative(j)); j++; @@ -302,9 +303,9 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent; bool isPrevLine; if (lineCurrent > 0) { @@ -321,10 +322,10 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init int style = initStyle; int levelDeltaNext = 0; /***************************************/ - int lastStart = 0; + Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); char chNextNonBlank = chNext; @@ -332,7 +333,7 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init if (IsALineEnd(chNextNonBlank)) { nextEOL = true; } - unsigned int j=i+1; + Sci_PositionU j=i+1; while(IsABlank(chNextNonBlank) && j(tolower(styler[lastStart+k])); } @@ -386,7 +387,7 @@ static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int init if (depth == 0) break; } } - int tmpLineCurrent = lineCurrent; + Sci_Position tmpLineCurrent = lineCurrent; while (j(styler[start + i]); i++; @@ -197,19 +197,19 @@ static int ClassifyFoldPointGAP(const char* s) { return level; } -static void FoldGAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList**, Accessor &styler) { - unsigned int endPos = startPos + length; +static void FoldGAPDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** , Accessor &styler) { + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; - int lastStart = 0; + Sci_Position lastStart = 0; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; diff --git a/lexers/LexGui4Cli.cxx b/lexers/LexGui4Cli.cxx index 4cba4ceff..c1625160a 100644 --- a/lexers/LexGui4Cli.cxx +++ b/lexers/LexGui4Cli.cxx @@ -68,9 +68,9 @@ inline bool isGCOperator(int ch) #define isFoldPoint(x) ((styler.LevelAt(x) & SC_FOLDLEVELNUMBERMASK) == 1024) static void colorFirstWord(WordList *keywordlists[], Accessor &styler, - StyleContext *sc, char *buff, int length, int) + StyleContext *sc, char *buff, Sci_Position length, int) { - int c = 0; + Sci_Position c = 0; while (sc->More() && isSpaceOrNL(sc->ch)) { sc->Forward(); } @@ -124,7 +124,8 @@ ColouriseGui4CliDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, { styler.StartAt(startPos); - int quotestart = 0, oldstate, currentline = styler.GetLine(startPos); + Sci_Position currentline = styler.GetLine(startPos); + int quotestart = 0, oldstate; styler.StartSegment(startPos); bool noforward; char buff[BUFFSIZE+1]; // buffer for command name @@ -248,15 +249,15 @@ static void FoldGui4Cli(Sci_PositionU startPos, Sci_Position length, int, { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; - for (unsigned int i = startPos; i < endPos; i++) + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx index ba536c46d..59c9e8ee4 100644 --- a/lexers/LexHTML.cxx +++ b/lexers/LexHTML.cxx @@ -57,17 +57,17 @@ inline bool IsOperator(int ch) { return false; } -static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) { - unsigned int i = 0; +static void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) { + Sci_PositionU i = 0; for (; (i < end - start + 1) && (i < len-1); i++) { s[i] = static_cast(MakeLowerCase(styler[start + i])); } s[i] = '\0'; } -static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, size_t sLen) { +static const char *GetNextWord(Accessor &styler, Sci_PositionU start, char *s, size_t sLen) { - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < sLen-1; i++) { char ch = static_cast(styler.SafeGetCharAt(start + i)); if ((i == 0) && !IsAWordStart(ch)) @@ -81,7 +81,7 @@ static const char *GetNextWord(Accessor &styler, unsigned int start, char *s, si return s; } -static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { +static script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); //Platform::DebugPrintf("Scripting indicator [%s]\n", s); @@ -110,7 +110,7 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, return prevValue; } -static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) { +static int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) { int iResult = 0; char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); @@ -171,7 +171,7 @@ static int stateForPrintState(int StateToPrint) { return state; } -static inline bool IsNumber(unsigned int start, Accessor &styler) { +static inline bool IsNumber(Sci_PositionU start, Accessor &styler) { return IsADigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); } @@ -242,7 +242,7 @@ static inline bool isCommentASPState(int state) { return bResult; } -static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static void classifyAttribHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { bool wordIsNumber = IsNumber(start, styler); char chAttr = SCE_H_ATTRIBUTEUNKNOWN; if (wordIsNumber) { @@ -259,14 +259,14 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k styler.ColourTo(end, chAttr); } -static int classifyTagHTML(unsigned int start, unsigned int end, +static int classifyTagHTML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, bool &tagDontFold, bool caseSensitive, bool isXml, bool allowScripts) { char withSpace[30 + 2] = " "; const char *s = withSpace + 1; // Copy after the '<' - unsigned int i = 1; - for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) { + Sci_PositionU i = 1; + for (Sci_PositionU cPos = start; cPos <= end && i < 30; cPos++) { char ch = styler[cPos]; if ((ch != '<') && (ch != '/')) { withSpace[i++] = caseSensitive ? ch : static_cast(MakeLowerCase(ch)); @@ -298,7 +298,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, if (allowScripts && 0 == strcmp(s, "script")) { // check to see if this is a self-closing tag by sniffing ahead bool isSelfClose = false; - for (unsigned int cPos = end; cPos <= end + 200; cPos++) { + for (Sci_PositionU cPos = end; cPos <= end + 200; cPos++) { char ch = styler.SafeGetCharAt(cPos, '\0'); if (ch == '\0' || ch == '>') break; @@ -318,10 +318,10 @@ static int classifyTagHTML(unsigned int start, unsigned int end, return chAttr; } -static void classifyWordHTJS(unsigned int start, unsigned int end, +static void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -337,7 +337,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); } -static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { +static int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HB_IDENTIFIER; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) { @@ -358,10 +358,10 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw return SCE_HB_DEFAULT; } -static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) { +static void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType, bool isMako) { bool wordIsNumber = IsADigit(styler[start]); char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -383,7 +383,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key // Update the word colour to default or keyword // Called when in a PHP word -static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char chAttr = SCE_HPHP_DEFAULT; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1])); if (wordIsNumber) { @@ -397,9 +397,9 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke styler.ColourTo(end, chAttr); } -static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { +static bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -407,9 +407,9 @@ static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords return keywords.InList(s); } -static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) { +static bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { char s[30 + 1]; - unsigned int i = 0; + Sci_PositionU i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } @@ -520,9 +520,9 @@ static bool isPHPStringState(int state) { (state == SCE_HPHP_COMPLEX_VARIABLE); } -static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler, bool &isSimpleString) { - int j; - const int beginning = i - 1; +static Sci_Position FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) { + Sci_Position j; + const Sci_Position beginning = i - 1; bool isValidSimpleString = false; while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t')) @@ -592,7 +592,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i // If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen if (InTagState(state)) { while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) { - int backLineStart = styler.LineStart(styler.GetLine(startPos-1)); + Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1)); length += startPos - backLineStart; startPos = backLineStart; } @@ -610,7 +610,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i } styler.StartAt(startPos); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int lineState; if (lineCurrent > 0) { lineState = styler.GetLineState(lineCurrent-1); @@ -695,7 +695,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i int chPrevNonWhite = ' '; // look back to set chPrevNonWhite properly for better regex colouring if (scriptLanguage == eScriptJS && startPos > 0) { - int back = startPos; + Sci_Position back = startPos; int style = 0; while (--back) { style = styler.StyleAt(back); @@ -709,8 +709,8 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i } styler.StartSegment(startPos); - const int lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { + const Sci_Position lengthDoc = startPos + length; + for (Sci_Position i = startPos; i < lengthDoc; i++) { const int chPrev2 = chPrev; chPrev = ch; if (!IsASpace(ch) && state != SCE_HJ_COMMENT && @@ -746,7 +746,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle); //if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) { if (ch == '#') { - int j = i + 1; + Sci_Position j = i + 1; while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } @@ -769,7 +769,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) { // check if the number of tabs is lower than the level int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8; - for (int j = 0; Findlevel > 0; j++) { + for (Sci_Position j = 0; Findlevel > 0; j++) { char chTmp = styler.SafeGetCharAt(i + j + 1); if (chTmp == '\t') { Findlevel -= 8; @@ -875,7 +875,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i if (const char *tag = state == SCE_HJ_COMMENTLINE || isXml ? "script" : state == SCE_H_COMMENT ? "comment" : 0) { - int j = i + 2; + Sci_Position j = i + 2; int chr; do { chr = static_cast(*tag++); @@ -1237,7 +1237,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SGML_SIMPLESTRING; } else if ((ch == '-') && (chPrev == '-')) { - if (static_cast(styler.GetStartSegment()) <= (i - 2)) { + if (static_cast(styler.GetStartSegment()) <= (i - 2)) { styler.ColourTo(i - 2, StateToPrint); } state = SCE_H_SGML_COMMENT; @@ -2080,7 +2080,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i // Some of the above terminated their lexeme but since the same character starts // the same class again, only reenter if non empty segment. - bool nonEmptySegment = i >= static_cast(styler.GetStartSegment()); + bool nonEmptySegment = i >= static_cast(styler.GetStartSegment()); if (state == SCE_HB_DEFAULT) { // One of the above succeeded if ((ch == '\"') && (nonEmptySegment)) { state = SCE_HB_STRING; @@ -2136,7 +2136,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i break; default: StateToPrint = statePrintForState(state, inScriptType); - if (static_cast(styler.GetStartSegment()) < lengthDoc) + if (static_cast(styler.GetStartSegment()) < lengthDoc) styler.ColourTo(lengthDoc - 1, StateToPrint); break; } diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx index 18ac15db9..0dd67d0ae 100644 --- a/lexers/LexHaskell.cxx +++ b/lexers/LexHaskell.cxx @@ -143,13 +143,13 @@ static inline int CommentBlockStyleFromNestLevel(const unsigned int nestLevel) { // Mangled version of lexlib/Accessor.cxx IndentAmount. // Modified to treat comment blocks as whitespace // plus special case for commentline/preprocessor. -static int HaskellIndentAmount(Accessor &styler, const int line) { +static int HaskellIndentAmount(Accessor &styler, const Sci_Position line) { // Determines the indentation level of the current line // Comment blocks are treated as whitespace - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; + Sci_Position pos = styler.LineStart(line); + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; char ch = styler[pos]; int style = styler.StyleAt(pos); @@ -157,7 +157,7 @@ static int HaskellIndentAmount(Accessor &styler, const int line) { int indent = 0; bool inPrevPrefix = line > 0; - int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; + Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; while (( ch == ' ' || ch == '\t' || IsCommentBlockStyle(style) @@ -271,7 +271,7 @@ struct OptionSetHaskell : public OptionSet { class LexerHaskell : public ILexer { bool literate; - int firstImportLine; + Sci_Position firstImportLine; int firstImportIndent; WordList keywords; WordList ffi; @@ -347,12 +347,12 @@ class LexerHaskell : public ILexer { } } - bool LineContainsImport(const int line, Accessor &styler) const { + bool LineContainsImport(const Sci_Position line, Accessor &styler) const { if (options.foldImports) { - int currentPos = styler.LineStart(line); + Sci_Position currentPos = styler.LineStart(line); int style = styler.StyleAt(currentPos); - int eol_pos = styler.LineStart(line + 1) - 1; + Sci_Position eol_pos = styler.LineStart(line + 1) - 1; while (currentPos < eol_pos) { int ch = styler[currentPos]; @@ -374,7 +374,7 @@ class LexerHaskell : public ILexer { } } - inline int IndentAmountWithOffset(Accessor &styler, const int line) const { + inline int IndentAmountWithOffset(Accessor &styler, const Sci_Position line) const { const int indent = HaskellIndentAmount(styler, line); const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK; return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE) @@ -461,7 +461,7 @@ Sci_Position SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) { wordListN = &reserved_operators; break; } - int firstModification = -1; + Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); @@ -477,7 +477,7 @@ void SCI_METHOD LexerHaskell::Lex(Sci_PositionU startPos, Sci_Position length, i ,IDocument *pAccess) { LexAccessor styler(pAccess); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); HaskellLineInfo hs = HaskellLineInfo(lineCurrent ? styler.GetLineState(lineCurrent-1) : 0); @@ -968,19 +968,19 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, Accessor styler(pAccess, NULL); - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent <= firstImportLine) { firstImportLine = -1; // readjust first import position firstImportIndent = 0; } - const int maxPos = startPos + length; - const int maxLines = + const Sci_Position maxPos = startPos + length; + const Sci_Position maxLines = maxPos == styler.Length() ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line - const int docLines = styler.GetLine(styler.Length()); // Available last line + const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line // Backtrack to previous non-blank line so we can determine indent level // for any white space lines @@ -1018,7 +1018,7 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, while (lineCurrent <= docLines && lineCurrent <= maxLines) { // Gather info - int lineNext = lineCurrent + 1; + Sci_Position lineNext = lineCurrent + 1; importHere = false; int indentNext = indentCurrent; @@ -1063,7 +1063,7 @@ void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, // which is indented more than the line after the end of // the comment-block, use the level of the block before - int skipLine = lineNext; + Sci_Position skipLine = lineNext; int skipLevel = indentNextLevel; while (--skipLine > lineCurrent) { diff --git a/lexers/LexHex.cxx b/lexers/LexHex.cxx index 1799624fa..d549881cb 100644 --- a/lexers/LexHex.cxx +++ b/lexers/LexHex.cxx @@ -126,37 +126,37 @@ using namespace Scintilla; 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); -static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler); -static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler); -static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler); +static int GetHexaChar(Sci_PositionU pos, Accessor &styler); +static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb = 1); +static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler); +static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler); +static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler); // prototypes for file format specific helper functions -static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler); -static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler); -static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler); -static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler); -static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler); - -static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler); -static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler); -static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler); -static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler); -static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler); -static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler); - -static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler); -static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler); -static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler); -static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler); -static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler); +static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler); +static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); + +static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler); +static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); +static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); + +static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); +static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); +static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); +static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); +static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static inline bool IsNewline(const int ch) { @@ -207,7 +207,7 @@ static int GetHexaChar(char hd1, char hd2) return hexValue; } -static int GetHexaChar(unsigned int pos, Accessor &styler) +static int GetHexaChar(Sci_PositionU pos, Accessor &styler) { char highNibble, lowNibble; @@ -221,9 +221,9 @@ static int GetHexaChar(unsigned int pos, Accessor &styler) // end. Return true if forwarding within the line was possible. // Avoids influence on highlighting of the subsequent line if the current line // is malformed (too short). -static bool ForwardWithinLine(StyleContext &sc, int nb) +static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb) { - for (int i = 0; i < nb; i++) { + for (Sci_Position i = 0; i < nb; i++) { if (sc.atLineEnd) { // line is too short sc.SetState(SCE_HEX_DEFAULT); @@ -238,7 +238,7 @@ static bool ForwardWithinLine(StyleContext &sc, int nb) } // Checks whether the given positions are in the same record. -static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styler) +static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler) { return styler.GetLine(pos1) == styler.GetLine(pos2); } @@ -246,10 +246,10 @@ static bool PosInSameRecord(unsigned int pos1, unsigned int pos2, Accessor &styl // Count the number of digit pairs from till end of record, ignoring // digits. // If the record is too short, a negative count may be returned. -static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor &styler) +static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler) { - int cnt; - unsigned int pos; + Sci_Position cnt; + Sci_PositionU pos; pos = startPos; @@ -258,7 +258,7 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor & } // number of digits in this line minus number of digits of uncounted fields - cnt = static_cast(pos - startPos) - uncountedDigits; + cnt = static_cast(pos - startPos) - uncountedDigits; // Prepare round up if odd (digit pair incomplete), this way the byte // count is considered to be valid if the checksum is incomplete. @@ -275,11 +275,11 @@ static int CountByteCount(unsigned int startPos, int uncountedDigits, Accessor & // Calculate the checksum of the record. // is the position of the first character of the starting digit // pair, is the number of digit pairs. -static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor &styler) +static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler) { int cs = 0; - for (unsigned int pos = startPos; pos < startPos + cnt; pos += 2) { + for (Sci_PositionU pos = startPos; pos < startPos + cnt; pos += 2) { int val = GetHexaChar(pos, styler); if (val < 0) { @@ -301,7 +301,7 @@ static int CalcChecksum(unsigned int startPos, int cnt, bool twosCompl, Accessor // Get the position of the record "start" field (first character in line) in // the record around position . -static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler) +static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != 'S') { pos--; @@ -312,7 +312,7 @@ static unsigned int GetSrecRecStartPosition(unsigned int pos, Accessor &styler) // Get the value of the "byte count" field, it counts the number of bytes in // the subsequent fields ("address", "data" and "checksum" fields). -static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler) +static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; @@ -327,13 +327,13 @@ static int GetSrecByteCount(unsigned int recStartPos, Accessor &styler) // Count the number of digit pairs for the "address", "data" and "checksum" // fields in this record. Has to be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. -static int CountSrecByteCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 4, styler); } // Get the size of the "address" field. -static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler) +static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -357,7 +357,7 @@ static int GetSrecAddressFieldSize(unsigned int recStartPos, Accessor &styler) } // Get the type of the "address" field content. -static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -383,7 +383,7 @@ static int GetSrecAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the type of the "data" field content. -static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler) +static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': @@ -407,7 +407,7 @@ static int GetSrecDataFieldType(unsigned int recStartPos, Accessor &styler) // Get the required size of the "data" field. Useless for block header and // ordinary data records (type S0, S1, S2, S3), return the value calculated // from the "byte count" and "address field" size in this case. -static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler) +static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '5': @@ -425,7 +425,7 @@ static int GetSrecRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl } // Get the value of the "checksum" field. -static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler) +static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -435,9 +435,9 @@ static int GetSrecChecksum(unsigned int recStartPos, Accessor &styler) } // Calculate the checksum of the record. -static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { - int byteCount; + Sci_Position byteCount; byteCount = GetSrecByteCount(recStartPos, styler); @@ -447,7 +447,7 @@ static int CalcSrecChecksum(unsigned int recStartPos, Accessor &styler) // Get the position of the record "start" field (first character in line) in // the record around position . -static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler) +static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != ':') { pos--; @@ -458,7 +458,7 @@ static unsigned int GetIHexRecStartPosition(unsigned int pos, Accessor &styler) // Get the value of the "byte count" field, it counts the number of bytes in // the "data" field. -static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler) +static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; @@ -473,13 +473,13 @@ static int GetIHexByteCount(unsigned int recStartPos, Accessor &styler) // Count the number of digit pairs for the "data" field in this record. Has to // be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. -static int CountIHexByteCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 11, styler); } // Get the type of the "address" field content. -static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { if (!PosInSameRecord(recStartPos, recStartPos + 7, styler)) { // malformed (record too short) @@ -504,7 +504,7 @@ static int GetIHexAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the type of the "data" field content. -static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler) +static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x00: @@ -528,7 +528,7 @@ static int GetIHexDataFieldType(unsigned int recStartPos, Accessor &styler) // Get the required size of the "data" field. Useless for an ordinary data // record (type 00), return the "byte count" in this case. -static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styler) +static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x01: @@ -548,7 +548,7 @@ static int GetIHexRequiredDataFieldSize(unsigned int recStartPos, Accessor &styl } // Get the value of the "checksum" field. -static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler) +static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -558,7 +558,7 @@ static int GetIHexChecksum(unsigned int recStartPos, Accessor &styler) } // Calculate the checksum of the record. -static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; @@ -571,7 +571,7 @@ static int CalcIHexChecksum(unsigned int recStartPos, Accessor &styler) // Get the value of the "record length" field, it counts the number of digits in // the record excluding the percent. -static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler) +static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { int val = GetHexaChar(recStartPos + 1, styler); if (val < 0) @@ -582,9 +582,9 @@ static int GetTEHexDigitCount(unsigned int recStartPos, Accessor &styler) // Count the number of digits in this record. Has to // be equal to the "record length" field value. -static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler) +static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { - unsigned int pos; + Sci_PositionU pos; pos = recStartPos+1; @@ -592,11 +592,11 @@ static int CountTEHexDigitCount(unsigned int recStartPos, Accessor &styler) pos++; } - return static_cast(pos - (recStartPos+1)); + return static_cast(pos - (recStartPos+1)); } // Get the type of the "address" field content. -static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler) +static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 3)) { case '6': @@ -611,16 +611,16 @@ static int GetTEHexAddressFieldType(unsigned int recStartPos, Accessor &styler) } // Get the value of the "checksum" field. -static int GetTEHexChecksum(unsigned int recStartPos, Accessor &styler) +static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { return GetHexaChar(recStartPos+4, styler); } // Calculate the checksum of the record (excluding the checksum field). -static int CalcTEHexChecksum(unsigned int recStartPos, Accessor &styler) +static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { - unsigned int pos = recStartPos +1; - unsigned int length = GetTEHexDigitCount(recStartPos, styler); + Sci_PositionU pos = recStartPos +1; + Sci_PositionU length = GetTEHexDigitCount(recStartPos, styler); int cs = GetHexaNibble(styler.SafeGetCharAt(pos++));//length cs += GetHexaNibble(styler.SafeGetCharAt(pos++));//length @@ -650,7 +650,7 @@ static void ColouriseSrecDoc(Sci_PositionU startPos, Sci_Position length, int in StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int byteCount, reqByteCount, addrFieldSize, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; @@ -774,7 +774,7 @@ static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int in StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int byteCount, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; @@ -892,17 +892,17 @@ static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int in static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1); - unsigned int lineStartNext = styler.LineStart(lineCurrent + 1); + Sci_PositionU lineStartNext = styler.LineStart(lineCurrent + 1); int levelNext = SC_FOLDLEVELBASE; // default if no specific line found - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { bool atEOL = i == (lineStartNext - 1); int style = styler.StyleAt(i); @@ -912,7 +912,7 @@ static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi levelNext = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; } else if (style == SCE_HEX_DATAADDRESS || (style == SCE_HEX_DEFAULT - && i == (unsigned int)styler.LineStart(lineCurrent))) { + && i == (Sci_PositionU)styler.LineStart(lineCurrent))) { // data record or no record start code at all if (levelCurrent & SC_FOLDLEVELHEADERFLAG) { levelNext = SC_FOLDLEVELBASE + 1; @@ -938,7 +938,7 @@ static void ColouriseTEHexDoc(Sci_PositionU startPos, Sci_Position length, int i StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { - unsigned int recStartPos; + Sci_PositionU recStartPos; int digitCount, addrFieldType; int cs1, cs2; diff --git a/lexers/LexInno.cxx b/lexers/LexInno.cxx index d9b481f2a..d60377eda 100644 --- a/lexers/LexInno.cxx +++ b/lexers/LexInno.cxx @@ -32,9 +32,9 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W char chPrev; char ch = 0; char chNext = styler[startPos]; - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; char *buffer = new char[length]; - int bufferCount = 0; + Sci_Position bufferCount = 0; bool isBOL, isEOL, isWS, isBOLWS = 0; bool isCStyleComment = false; @@ -45,7 +45,7 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W WordList &pascalKeywords = *keywordLists[4]; WordList &userKeywords = *keywordLists[5]; - int curLine = styler.GetLine(startPos); + Sci_Position curLine = styler.GetLine(startPos); int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0; bool isCode = (curLineState == 1); @@ -53,7 +53,7 @@ static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, W // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { chPrev = ch; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -249,16 +249,16 @@ static const char * const innoWordListDesc[] = { }; static void FoldInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; char chNext = styler[startPos]; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); bool sectionFlag = false; int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE; int level; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); diff --git a/lexers/LexKVIrc.cxx b/lexers/LexKVIrc.cxx index 5aa35cf99..76259db7e 100644 --- a/lexers/LexKVIrc.cxx +++ b/lexers/LexKVIrc.cxx @@ -313,10 +313,10 @@ static void ColouriseKVIrcDoc(Sci_PositionU startPos, Sci_Position length, * fetching the current word, NULL-terminated like * the keyword list */ char s[100]; - int wordLen = sc.currentPos - styler.GetStartSegment(); + Sci_Position wordLen = sc.currentPos - styler.GetStartSegment(); if (wordLen > 99) wordLen = 99; /* Include '\0' in buffer */ - int i; + Sci_Position i; for( i = 0; i < wordLen; ++i ) { s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i ); @@ -365,11 +365,11 @@ static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*init return; /* Obtaining current line number*/ - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); /* Obtaining starting character - indentation is done on a line basis, * not character */ - unsigned int safeStartPos = styler.LineStart( currentLine ); + Sci_PositionU safeStartPos = styler.LineStart( currentLine ); /* Initialising current level - this is defined as indentation level * in the low 12 bits, with flag bits in the upper four bits. @@ -386,7 +386,7 @@ static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*init int nextLevel = currentLevel; // Looping for characters in range - for (unsigned int i = safeStartPos; i < startPos + length; ++i) + for (Sci_PositionU i = safeStartPos; i < startPos + length; ++i) { /* Folding occurs after syntax highlighting, meaning Scintilla * already knows where the comments are diff --git a/lexers/LexLaTeX.cxx b/lexers/LexLaTeX.cxx index d2ab191fa..7e03a9c4c 100644 --- a/lexers/LexLaTeX.cxx +++ b/lexers/LexLaTeX.cxx @@ -48,33 +48,33 @@ struct latexFoldSave { class LexerLaTeX : public LexerBase { private: vector modes; - void setMode(int line, int mode) { - if (line >= static_cast(modes.size())) modes.resize(line + 1, 0); + void setMode(Sci_Position line, int mode) { + if (line >= static_cast(modes.size())) modes.resize(line + 1, 0); modes[line] = mode; } - int getMode(int line) { - if (line >= 0 && line < static_cast(modes.size())) return modes[line]; + int getMode(Sci_Position line) { + if (line >= 0 && line < static_cast(modes.size())) return modes[line]; return 0; } - void truncModes(int numLines) { - if (static_cast(modes.size()) > numLines * 2 + 256) + void truncModes(Sci_Position numLines) { + if (static_cast(modes.size()) > numLines * 2 + 256) modes.resize(numLines + 128); } vector saves; - void setSave(int line, const latexFoldSave &save) { - if (line >= static_cast(saves.size())) saves.resize(line + 1); + void setSave(Sci_Position line, const latexFoldSave &save) { + if (line >= static_cast(saves.size())) saves.resize(line + 1); saves[line] = save; } - void getSave(int line, latexFoldSave &save) { - if (line >= 0 && line < static_cast(saves.size())) save = saves[line]; + void getSave(Sci_Position line, latexFoldSave &save) { + if (line >= 0 && line < static_cast(saves.size())) save = saves[line]; else { save.structLev = 0; for (int i = 0; i < 8; ++i) save.openBegins[i] = 0; } } - void truncSaves(int numLines) { - if (static_cast(saves.size()) > numLines * 2 + 256) + void truncSaves(Sci_Position numLines) { + if (static_cast(saves.size()) > numLines * 2 + 256) saves.resize(numLines + 128); } public: @@ -102,7 +102,7 @@ static bool latexIsLetter(int ch) { return IsASCII(ch) && isalpha(ch); } -static bool latexIsTagValid(int &i, int l, Accessor &styler) { +static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) { while (i < l) { if (styler.SafeGetCharAt(i) == '{') { while (i < l) { @@ -122,7 +122,7 @@ static bool latexIsTagValid(int &i, int l, Accessor &styler) { return false; } -static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { +static bool latexNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) { char ch; while (i < styler.Length()) { ch = styler.SafeGetCharAt(i); @@ -137,10 +137,10 @@ static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { return false; } -static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { - unsigned int i = 0; - unsigned int l = static_cast(strlen(needle)); - int ini = start-l+1; +static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *needle) { + Sci_PositionU i = 0; + Sci_PositionU l = static_cast(strlen(needle)); + Sci_Position ini = start-l+1; char s[32]; while (i < l && i < 31) { @@ -152,8 +152,8 @@ static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { return (strcmp(s, needle) == 0); } -static bool latexLastWordIsMathEnv(int pos, Accessor &styler) { - int i, j; +static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) { + Sci_Position i, j; char s[32]; const char *mathEnvs[] = { "align", "alignat", "flalign", "gather", "multiline", "displaymath", "eqnarray", "equation" }; @@ -196,9 +196,9 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int char chNext = styler.SafeGetCharAt(startPos); char chVerbatimDelim = '\0'; styler.StartSegment(startPos); - int lengthDoc = startPos + length; + Sci_Position lengthDoc = startPos + length; - for (int i = startPos; i < lengthDoc; i++) { + for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -325,7 +325,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -367,7 +367,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -418,7 +418,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int break; case SCE_L_COMMENT2 : if (ch == '\\') { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -432,7 +432,7 @@ void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int break; case SCE_L_VERBATIM : if (ch == '\\') { - int match = i + 3; + Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { @@ -474,19 +474,20 @@ void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, in const char *structWords[7] = {"part", "chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"}; Accessor styler(pAccess, &props); - unsigned int endPos = startPos + length; - int curLine = styler.GetLine(startPos); + Sci_PositionU endPos = startPos + length; + Sci_Position curLine = styler.GetLine(startPos); latexFoldSave save; getSave(curLine - 1, save); do { char ch, buf[16]; - int i, j, lev = -1; + Sci_Position i, j; + int lev = -1; bool needFold = false; - for (i = static_cast(startPos); i < static_cast(endPos); ++i) { + for (i = static_cast(startPos); i < static_cast(endPos); ++i) { ch = styler.SafeGetCharAt(i); if (ch == '\r' || ch == '\n') break; if (ch != '\\' || styler.StyleAt(i) != SCE_L_COMMAND) continue; - for (j = 0; j < 15 && i + 1 < static_cast(endPos); ++j, ++i) { + for (j = 0; j < 15 && i + 1 < static_cast(endPos); ++j, ++i) { buf[j] = styler.SafeGetCharAt(i + 1); if (!latexIsLetter(buf[j])) break; } @@ -522,7 +523,7 @@ void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, in setSave(curLine, save); ++curLine; startPos = styler.LineStart(curLine); - if (static_cast(startPos) == styler.Length()) { + if (static_cast(startPos) == styler.Length()) { lev = latexFoldSaveToInt(save); styler.SetLevel(curLine, lev); setSave(curLine, save); diff --git a/lexers/LexLisp.cxx b/lexers/LexLisp.cxx index aba094cfa..8d81eae2e 100644 --- a/lexers/LexLisp.cxx +++ b/lexers/LexLisp.cxx @@ -46,10 +46,10 @@ static inline bool isLispwordstart(char ch) { } -static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) { +static void classifyWordLisp(Sci_PositionU start, Sci_PositionU end, WordList &keywords, WordList &keywords_kw, Accessor &styler) { assert(end >= start); char s[100]; - unsigned int i; + Sci_PositionU i; bool digit_flag = true; for (i = 0; (i < end - start + 1) && (i < 99); i++) { s[i] = styler[start + i]; @@ -84,9 +84,9 @@ static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int in int state = initStyle, radix = -1; char chNext = styler[startPos]; - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; styler.StartSegment(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); @@ -235,14 +235,14 @@ static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int in static void FoldLispDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { - unsigned int lengthDoc = startPos + length; + Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < lengthDoc; i++) { + for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; diff --git a/lexers/LexLout.cxx b/lexers/LexLout.cxx index e0458218d..39709827d 100644 --- a/lexers/LexLout.cxx +++ b/lexers/LexLout.cxx @@ -143,9 +143,9 @@ static void ColouriseLoutDoc(Sci_PositionU startPos, Sci_Position length, int in static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - unsigned int endPos = startPos + length; + Sci_PositionU endPos = startPos + length; int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); + Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; @@ -153,7 +153,7 @@ static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi int styleNext = styler.StyleAt(startPos); char s[10] = ""; - for (unsigned int i = startPos; i < endPos; i++) { + for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; @@ -162,7 +162,7 @@ static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordLi if (style == SCE_LOUT_WORD) { if (ch == '@') { - for (unsigned int j = 0; j < 8; j++) { + for (Sci_PositionU j = 0; j < 8; j++) { if (!IsAWordChar(styler[i + j])) { break; } diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx index 7ef4a9080..b62e69a35 100644 --- a/lexers/LexLua.cxx +++ b/lexers/LexLua.cxx @@ -67,7 +67,7 @@ static void ColouriseLuaDoc( CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#"); CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\"); - int currentLine = styler.GetLine(startPos); + Sci_Position currentLine = styler.GetLine(startPos); // Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level, // if we are inside such a string. Block comment was introduced in Lua 5.0, // blocks with separators [=[ ... ]=] in Lua 5.1. @@ -132,10 +132,10 @@ static void ColouriseLuaDoc( if (sc.state == SCE_LUA_OPERATOR) { if (sc.ch == ':' && sc.chPrev == ':') { // ::