Skip to content

Commit

Permalink
Final commit for 5.8.3 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMes committed Nov 13, 2014
1 parent bd3272f commit 41155d4
Show file tree
Hide file tree
Showing 11 changed files with 427 additions and 431 deletions.
Binary file modified GitPush.exe
Binary file not shown.
12 changes: 9 additions & 3 deletions NEWS.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Version 5.8.3 - *

-
Version 5.8.3 - 10 November 2014

- Slightly decreased flicker during editor opening.
- Makefiles are now edited as if they are source files. It's better than nothing.
- Opening braces after default are now completed correctly.
- Fixed a bug in NewFunctionFrm and NewVarFrm that caused crashes (thank you for reporting).
- Rewritten ancient source code of devcppPortable.exe. It is now immune to overflows due to arguments of length more than 400.
- Fixed a bug in TCppParser that caused it to ignore project include paths.
- Fixed a crash in TCppTokenizer due to spaces before #include in combination with comments after the <file> or "file" part (like " #include <foo> // bar").

Version 5.8.2 - 1 November 2014

Expand Down
24 changes: 3 additions & 21 deletions Source/Editor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -928,12 +928,6 @@ procedure TEditor.CompletionKeyPress(Sender: TObject; var Key: Char);
end;

procedure TEditor.HandleSymbolCompletion(var Key: Char);
var
Attr: TSynHighlighterAttributes;
Token: AnsiString;
HighlightPos: TBufferCoord;
TabCount: integer;

procedure HandleParentheseCompletion;
begin
InsertString(')', false);
Expand Down Expand Up @@ -975,7 +969,7 @@ procedure TEditor.HandleSymbolCompletion(var Key: Char);
procedure HandleBraceCompletion;
var
KeyWordBefore, Indent, MoreIndent: AnsiString;
IndentCount: integer;
IndentCount, TabCount: integer;
begin
// Determine what word is before us
KeyWordBefore := Trim(Copy(fText.LineText, 1, fText.CaretX - 1));
Expand All @@ -994,7 +988,8 @@ procedure TEditor.HandleSymbolCompletion(var Key: Char);

// For case, do the following:
//{ + enter + indent + tab + break; + enter + }
if StartsStr('case', KeyWordBefore) then begin
if StartsStr('case', KeyWordBefore) or
StartsStr('default', KeyWordBefore) then begin

// Get extra indentation string
if eoTabsToSpaces in fText.Options then
Expand All @@ -1013,7 +1008,6 @@ procedure TEditor.HandleSymbolCompletion(var Key: Char);
EndsStr('else', KeyWordBefore) or
EndsStr('try', KeyWordBefore) or
EndsStr('catch', KeyWordBefore) or
EndsStr('default', KeyWordBefore) or
EndsStr('do', KeyWordBefore) then begin

InsertString('{' + #13#10 + Indent + '}', false);
Expand Down Expand Up @@ -1078,18 +1072,6 @@ procedure TEditor.HandleSymbolCompletion(var Key: Char);
if not devEditor.CompleteSymbols or fText.SelAvail then
Exit;

// Find the end of the first nonblank line above us
HighlightPos := BufferCoord(fText.CaretX - 1, fText.CaretY);
while (HighlightPos.Line > 0) and (Length(fText.Lines[HighlightPos.Line - 1]) = 0) do
Dec(HighlightPos.Line);
HighlightPos.Char := Length(fText.Lines[HighlightPos.Line - 1]);

// Check if that line is highlighted as string or character or comment
if fText.GetHighlighterAttriAtRowCol(HighlightPos, Token, Attr) then
if (Attr = fText.Highlighter.StringAttribute) or (Attr = fText.Highlighter.CommentAttribute) or SameStr(Attr.Name,
'Character') then
Exit;

case Key of
'(': begin
if devEditor.ParentheseComplete then
Expand Down
6 changes: 3 additions & 3 deletions Source/Tools/DevCppPortable/devcppPortable.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FileName=devcppPortable.dev
Name=devcppPortable
Type=1
Ver=1
Ver=2
ObjFiles=
Includes=
Libs=
Expand All @@ -27,8 +27,8 @@ UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=1
CompilerSettings=000000000000000000001100d10
CompilerSet=3
CompilerSettings=0000000100111000000001001
UnitCount=2

[VersionInfo]
Expand Down
36 changes: 22 additions & 14 deletions Source/Tools/DevCppPortable/main.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
#include <windows.h>
#include <string>
using std::wstring;

// Tried to use wmain, but GCC/MinGW doesn't define it cause it's MS specific
// So, I'm sticking to the Windows API for now

int main() {
// Fill an argv array and argc similar to the standard ones
int argc;
wchar_t** argv = CommandLineToArgvW(GetCommandLineW(),&argc);
int ArgumentCount = 0;
wchar_t** ArgumentInput = CommandLineToArgvW(GetCommandLineW(),&ArgumentCount);

// Then build our selection to pass to devcpp.exe
wchar_t argtodev[400] = L"-c .\\config ";
for(unsigned int i = 1;i < argc;i++) {
wcscat(argtodev,&argv[i][0]);
wstring ArgumentsToDev = L"-c .\\config ";
for(int i = 1;i < ArgumentCount;i++) {
ArgumentsToDev.append(ArgumentInput[i]);
}

HINSTANCE returnvalue = ShellExecuteW(NULL,L"open",L"devcpp.exe",argtodev,NULL,SW_SHOWNORMAL);
if((int)returnvalue <= 32) {
if(GetLastError()==ERROR_FILE_NOT_FOUND) {
MessageBoxW(NULL,L"devcpp.exe",L"File not found",MB_OK);
} else {
MessageBoxW(NULL,L"no worky!",L"Error",MB_OK);
// Free the strings pointed to by argv
LocalFree(ArgumentInput);

// Attempt to execute
int Result = (INT_PTR)ShellExecuteW(NULL,L"open",L"devcpp.exe",ArgumentsToDev.c_str(),NULL,SW_SHOWNORMAL);
if(Result <= 32) {
switch(Result) {
case ERROR_FILE_NOT_FOUND: {
MessageBoxW(NULL,L"devcpp.exe",L"File not found",MB_OK);
break;
}
default: {
MessageBoxW(NULL,L"An unspecified error has occured!",L"Error",MB_OK);
break;
}
}
}

// Free the strings pointed to by argv
LocalFree(argv);
return 0;
}
4 changes: 2 additions & 2 deletions Source/Tools/GitPush/GitPush.dev
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ CommandLine=
Folders=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000000110000000001000
CompilerSet=3
CompilerSettings=0000000100111000000001001
UnitCount=1

[VersionInfo]
Expand Down
3 changes: 1 addition & 2 deletions Source/VCL/ClassBrowsing/CppParser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1939,8 +1939,7 @@ procedure TCppParser.ReParseFile(const FileName: AnsiString; InProject: boolean;

// Always invalidate file pairs. If we don't, reparsing the header
// screws up the information inside the source file
if not Assigned(Stream) then
GetSourcePair(FName, CFile, HFile);
GetSourcePair(FName, CFile, HFile);
fInvalidatedIDs.Clear;
if not Assigned(Stream) then begin
InvalidateFile(CFile);
Expand Down
43 changes: 22 additions & 21 deletions Source/VCL/ClassBrowsing/CppPreprocessor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ TCppPreprocessor = class(TComponent)
procedure HandleInclude(const Line: AnsiString);
function ExpandMacros(const Line: AnsiString): AnsiString;
function RemoveSuffixes(const Input: AnsiString): AnsiString;
// line checking stuff
function FirstLineChar(const Line: AnsiString): Char;
function LastLineChar(const Line: AnsiString): Char;
// current file stuff
function GetInclude(index: integer): PFile;
procedure OpenInclude(const FileName: AnsiString; Stream: TMemoryStream = nil);
Expand Down Expand Up @@ -175,22 +172,6 @@ procedure TCppPreprocessor.Reset;
ResetDefines; // do not throw away hardcoded
end;

function TCppPreprocessor.FirstLineChar(const Line: AnsiString): Char;
begin
if Length(Line) > 0 then
Result := Line[1]
else
Result := #0;
end;

function TCppPreprocessor.LastLineChar(const Line: AnsiString): Char;
begin
if Length(Line) > 0 then
Result := Line[Length(Line)]
else
Result := #0;
end;

function TCppPreprocessor.GetInclude(index: integer): PFile;
begin
result := PFile(fIncludes[index]);
Expand All @@ -201,6 +182,7 @@ procedure TCppPreprocessor.OpenInclude(const FileName: AnsiString; Stream: TMemo
FileItem: PFile;
IsSystemFile: boolean;
IncludeLine: AnsiString;
I: integer;
begin
// Backup old position if we're entering a new file
if fIncludes.Count > 0 then
Expand Down Expand Up @@ -256,6 +238,10 @@ procedure TCppPreprocessor.OpenInclude(const FileName: AnsiString; Stream: TMemo
fFileName := FileItem^.FileName;
fBuffer := FileItem^.Buffer;

// Trim all lines
for I := 0 to fBuffer.Count - 1 do
fBuffer[i] := Trim(fBuffer[i]);

// Update result file
IncludeLine := '#include ' + FileName + ':1';
if fIncludes.Count > 1 then // include from within a file
Expand Down Expand Up @@ -337,6 +323,13 @@ procedure TCppPreprocessor.SetScannedFileList(var List: TStringList);
end;

procedure TCppPreprocessor.SkipToPreprocessor;
function FirstLineChar(const Line: AnsiString): Char;
begin
if Length(Line) > 0 then
Result := TrimLeft(Line)[1] // assume trimmed lines
else
Result := #0;
end;
begin
// Increment until a line begins with a #
while (fIndex < fBuffer.Count) and (FirstLineChar(fBuffer[fIndex]) <> '#') do begin
Expand All @@ -349,6 +342,13 @@ procedure TCppPreprocessor.SkipToPreprocessor;
end;

procedure TCppPreprocessor.SkipToEndOfPreprocessor;
function LastLineChar(const Line: AnsiString): Char;
begin
if Length(Line) > 0 then
Result := Line[Length(Line)] // assume trimmed lines
else
Result := #0;
end;
begin
// Skip until last char of line is NOT \ anymore
while (fIndex < fBuffer.Count) and (LastLineChar(fBuffer[fIndex]) = '\') do begin
Expand Down Expand Up @@ -927,7 +927,8 @@ procedure TCppPreprocessor.HandleInclude(const Line: AnsiString);
Exit;

// Get full header file name
FileName := cbutils.GetHeaderFileName(Includes[fIncludes.Count - 1]^.FileName, Line, fIncludePaths, fProjectIncludePaths);
FileName := cbutils.GetHeaderFileName(Includes[fIncludes.Count - 1]^.FileName, Line, fIncludePaths,
fProjectIncludePaths);

// And open a new entry
OpenInclude(FileName);
Expand Down Expand Up @@ -995,7 +996,7 @@ procedure TCppPreprocessor.PreprocessFile(const FileName: AnsiString);
Reset;
OpenInclude(FileName, nil);
PreprocessBuffer;
//fResult.SaveToFile('C:\TCppPreprocessorResult.txt');
//fResult.SaveToFile('C:\TCppPreprocessorResult' + ExtractFileName(FileName) + '.txt');
end;

function TCppPreprocessor.GetResult: AnsiString;
Expand Down
Loading

0 comments on commit 41155d4

Please sign in to comment.