mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-30 23:00:18 -05:00
Made IncludeBuffer more threadsafe! + rev number = 695
This commit is contained in:
parent
aa0edf3ffe
commit
fe18850679
@ -46,7 +46,7 @@ uses
|
|||||||
CastaliaSimplePasPar, v_AutoCompleteForm, PSDump;
|
CastaliaSimplePasPar, v_AutoCompleteForm, PSDump;
|
||||||
|
|
||||||
const
|
const
|
||||||
SimbaVersion = 693;
|
SimbaVersion = 695;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -103,20 +103,19 @@ var
|
|||||||
begin
|
begin
|
||||||
for i := 0 to High(CoreBuffer) do
|
for i := 0 to High(CoreBuffer) do
|
||||||
FreeAndNil(CoreBuffer[i]);
|
FreeAndNil(CoreBuffer[i]);
|
||||||
|
|
||||||
SetLength(IncludeBuffer, 0);
|
SetLength(IncludeBuffer, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DeleteIncludeBufferIndex(Index: Integer);
|
procedure DeleteIncludeBufferIndex(Index: Integer);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
tmp : TCodeInsight;
|
||||||
begin
|
begin
|
||||||
IncludeBuffer[Index].CodeInsight.Free;
|
tmp := IncludeBuffer[Index].CodeInsight;
|
||||||
|
|
||||||
for i := Index to High(IncludeBuffer) - 1 do
|
for i := Index to High(IncludeBuffer) - 1 do
|
||||||
IncludeBuffer[i] := IncludeBuffer[i + 1];
|
IncludeBuffer[i] := IncludeBuffer[i + 1];
|
||||||
|
|
||||||
SetLength(IncludeBuffer, Length(IncludeBuffer) - 1);
|
SetLength(IncludeBuffer, Length(IncludeBuffer) - 1);
|
||||||
|
tmp.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ClearIncludeBuffer;
|
procedure ClearIncludeBuffer;
|
||||||
@ -134,6 +133,8 @@ var
|
|||||||
i, l, lc: Integer;
|
i, l, lc: Integer;
|
||||||
Defines: TSaveDefinesRec;
|
Defines: TSaveDefinesRec;
|
||||||
DefineMatch: Boolean;
|
DefineMatch: Boolean;
|
||||||
|
NewBuf : TIncludeBuffer;
|
||||||
|
CS : TRTLCriticalSection;
|
||||||
begin
|
begin
|
||||||
lc := 1;//FileAge(FileName);
|
lc := 1;//FileAge(FileName);
|
||||||
Defines := ci.Lexer.SaveDefines;
|
Defines := ci.Lexer.SaveDefines;
|
||||||
@ -166,9 +167,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
with NewBuf do
|
||||||
SetLength(IncludeBuffer, l + 1);
|
|
||||||
with IncludeBuffer[l] do
|
|
||||||
begin
|
begin
|
||||||
Script := ci.FileName;
|
Script := ci.FileName;
|
||||||
DefinesIn := Defines;
|
DefinesIn := Defines;
|
||||||
@ -194,9 +193,16 @@ begin
|
|||||||
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
|
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
|
||||||
ci.Lexer.CloneDefinesFrom(Lexer);
|
ci.Lexer.CloneDefinesFrom(Lexer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
InitCriticalSection(cs);
|
||||||
|
EnterCriticalsection(cs);
|
||||||
|
try
|
||||||
|
SetLength(IncludeBuffer, l + 1);
|
||||||
|
IncludeBuffer[l] := NewBuf;
|
||||||
|
finally
|
||||||
|
LeaveCriticalsection(cs);
|
||||||
|
end;
|
||||||
|
DoneCriticalsection(cs);
|
||||||
IncludeBuffer[l].DefinesOut := IncludeBuffer[l].CodeInsight.Lexer.SaveDefines;
|
IncludeBuffer[l].DefinesOut := IncludeBuffer[l].CodeInsight.Lexer.SaveDefines;
|
||||||
Result := IncludeBuffer[l];
|
Result := IncludeBuffer[l];
|
||||||
end;
|
end;
|
||||||
@ -245,6 +251,8 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
s: string;
|
s: string;
|
||||||
ci: TCodeInsight;
|
ci: TCodeInsight;
|
||||||
|
tmp : TIncludeBuffer;
|
||||||
|
CS : TRTLCriticalSection;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
@ -269,14 +277,21 @@ begin
|
|||||||
SetLength(fIncludes, Length(fIncludes) + 1);
|
SetLength(fIncludes, Length(fIncludes) + 1);
|
||||||
fIncludes[High(fIncludes)] := ci;
|
fIncludes[High(fIncludes)] := ci;
|
||||||
|
|
||||||
SetLength(IncludeBuffer, Length(IncludeBuffer) + 1);
|
with tmp do
|
||||||
with IncludeBuffer[High(IncludeBuffer)] do
|
|
||||||
begin
|
begin
|
||||||
Script := LibPrefix+LibName;
|
Script := LibPrefix+LibName;
|
||||||
CodeInsight := ci;
|
CodeInsight := ci;
|
||||||
CodeInsight.FileName := LibPrefix+LibName;
|
CodeInsight.FileName := LibPrefix+LibName;
|
||||||
end;
|
end;
|
||||||
|
InitCriticalSection(cs);
|
||||||
|
EnterCriticalsection(cs);
|
||||||
|
try
|
||||||
|
SetLength(IncludeBuffer, Length(IncludeBuffer) + 1);
|
||||||
|
IncludeBuffer[high(IncludeBuffer)] := tmp;
|
||||||
|
finally
|
||||||
|
LeaveCriticalsection(cs);
|
||||||
|
end;
|
||||||
|
DoneCriticalsection(cs);
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user