1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 02:32:19 -05:00

LoadDLL is now LoadLib (and it can also be used as a compiler directive {$loadlib libsmart}). Fixed a bug in PS-Script. Also fixed a segfault which would occur if you would do Ctrl + Space before it was done filling the corebuffer..

This commit is contained in:
Raymond 2010-05-18 20:58:15 +02:00
parent a4c7c30e77
commit e3d359b088
7 changed files with 31 additions and 16 deletions

View File

@ -46,7 +46,7 @@ uses
CastaliaSimplePasPar, v_AutoCompleteForm, PSDump; CastaliaSimplePasPar, v_AutoCompleteForm, PSDump;
const const
SimbaVersion = 670; SimbaVersion = 675;
type type
@ -539,7 +539,12 @@ var
b: TStringList; b: TStringList;
ms: TMemoryStream; ms: TMemoryStream;
begin begin
try
Index := PluginsGlob.LoadPlugin(LibName); Index := PluginsGlob.LoadPlugin(LibName);
except
Result := false;
Index := -1;
end;
if (Index < 0) then if (Index < 0) then
Exit(False) Exit(False)
else else
@ -2022,6 +2027,7 @@ var
a: TPSScriptExtension; a: TPSScriptExtension;
b: TStringList; b: TStringList;
ms: TMemoryStream; ms: TMemoryStream;
buf : TCodeInsight;
begin begin
if SimbaForm.UpdatingFonts then if SimbaForm.UpdatingFonts then
begin begin
@ -2053,15 +2059,16 @@ begin
CoreDefines.AddStrings(a.Defines); CoreDefines.AddStrings(a.Defines);
SetLength(CoreBuffer, 1); buf := TCodeInsight.Create;
CoreBuffer[0] := TCodeInsight.Create; with buf do
with CoreBuffer[0] do
begin begin
OnMessage := @SimbaForm.OnCCMessage; OnMessage := @SimbaForm.OnCCMessage;
b.SaveToStream(ms); b.SaveToStream(ms);
Run(ms, nil, -1, True); Run(ms, nil, -1, True);
FileName := '"PSCORE"'; FileName := '"PSCORE"';
end; end;
SetLength(CoreBuffer, 1);
CoreBuffer[0] := buf;
finally finally
b.Free; b.Free;
a.Free; a.Free;
@ -2517,7 +2524,7 @@ begin
if (NewPos <> OldPos) and (NewPos <> -1) then if (NewPos <> OldPos) and (NewPos <> -1) then
begin; begin;
Tabs.Move(OldPos,NewPos); Tabs.Move(OldPos,NewPos);
PageControl1.Pages[OldPos].TabIndex:= NewPos; PageControl1.Pages[OldPos].PageIndex := NewPos;
end; end;
end; end;

View File

@ -424,7 +424,7 @@ var
path : string; path : string;
begin begin
result := false; result := false;
if CompareText(DirectiveName,'LOADDLL') = 0 then if CompareText(DirectiveName,'LOADLIB') = 0 then
begin begin
if DirectiveArgs <> '' then if DirectiveArgs <> '' then
begin; begin;
@ -436,7 +436,7 @@ begin
result:= True; result:= True;
end; end;
end else end else
psWriteln('Your LoadDLL directive has no params, thus cannot find the plugin'); psWriteln('Your LoadLib directive has no params, thus cannot find the plugin');
end else end else
if CompareText(DirectiveName,'INCLUDE_ONCE') = 0 then if CompareText(DirectiveName,'INCLUDE_ONCE') = 0 then
begin begin
@ -598,7 +598,7 @@ procedure TPSThread.PSScriptProcessUnknowDirective(Sender: TPSPreProcessor;
Parser: TPSPascalPreProcessorParser; const Active: Boolean; Parser: TPSPascalPreProcessorParser; const Active: Boolean;
const DirectiveName, DirectiveParam: string; var Continue: Boolean); const DirectiveName, DirectiveParam: string; var Continue: Boolean);
begin begin
Continue:= ProcessDirective(DirectiveName, DirectiveParam); Continue:=not ProcessDirective(DirectiveName, DirectiveParam);
end; end;
function Muf_Conv_to_PS_Conv( conv : integer) : TDelphiCallingConvention; function Muf_Conv_to_PS_Conv( conv : integer) : TDelphiCallingConvention;

View File

@ -133,7 +133,7 @@ implementation
ii := i; ii := i;
end; end;
if ii = -1 then if ii = -1 then
raise Exception.CreateFMT('Plugins(%s) has not been found',[PluginName]); raise Exception.CreateFMT('Plugin(%s) has not been found',[PluginName]);
for i := 0 to PluginLen - 1 do for i := 0 to PluginLen - 1 do
if Loaded[i].filename = (PluginDirs.Strings[ii] + PluginName + PlugExt) then if Loaded[i].filename = (PluginDirs.Strings[ii] + PluginName + PlugExt) then
Exit(i); Exit(i);

View File

@ -1546,7 +1546,7 @@ begin
FDirectiveParamOrigin := FOrigin + FTokenPos; FDirectiveParamOrigin := FOrigin + FTokenPos;
FTokenPos := Run; FTokenPos := Run;
case KeyHash of case KeyHash of
60: if KeyComp('LOADDLL') then 55: if KeyComp('LOADLIB') then
fTokenID := tokIncludeDirect fTokenID := tokIncludeDirect
else else
fTokenID := tokBorComment; fTokenID := tokBorComment;
@ -2388,6 +2388,10 @@ begin
if KeyComp('UNDEF') then if KeyComp('UNDEF') then
Result := tokUndefDirect else Result := tokUndefDirect else
Result := tokCompDirect; Result := tokCompDirect;
55:
if KeyComp('LOADLIB') then
result := tokIncludeDirect else
result := tokCompDirect;
56: 56:
if KeyComp('ELSEIF') then if KeyComp('ELSEIF') then
Result := tokElseIfDirect else Result := tokElseIfDirect else

View File

@ -292,7 +292,7 @@ begin
{$ENDIF} {$ENDIF}
if (not Sender.IsJunk) and (Param <> '') then if (not Sender.IsJunk) and (Param <> '') then
begin begin
p := Pos('loaddll', LowerCase(Sender.Token)); p := Pos('loadlib', LowerCase(Sender.Token));
if (p > 0) and (p <= 3) then if (p > 0) and (p <= 3) then
begin begin
if LoadLibrary(Param) then if LoadLibrary(Param) then
@ -1322,6 +1322,8 @@ procedure TCodeInsight.FillSynCompletionProposal(ItemList, InsertList: TStrings;
var var
i: Integer; i: Integer;
begin begin
if item = nil then
exit;
if (not Item.Proposal_Filled) then if (not Item.Proposal_Filled) then
Item.FillProposal; Item.FillProposal;

View File

@ -447,7 +447,7 @@ procedure callObjectOnProcessDirective (
const DirectiveName, DirectiveParam: tbtstring; const DirectiveName, DirectiveParam: tbtstring;
Var Continue: Boolean); Var Continue: Boolean);
begin begin
TPSScript (Sender.ID).DoOnProcessUnknowDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue); TPSScript (Sender.ID).DoOnProcessDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue);
end; end;
procedure callObjectOnProcessUnknowDirective ( procedure callObjectOnProcessUnknowDirective (
@ -457,7 +457,7 @@ procedure callObjectOnProcessUnknowDirective (
const DirectiveName, DirectiveParam: tbtstring; const DirectiveName, DirectiveParam: tbtstring;
Var Continue: Boolean); Var Continue: Boolean);
begin begin
TPSScript (Sender.ID).DoOnProcessDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue); TPSScript (Sender.ID).DoOnProcessUnknowDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue);
end; end;

View File

@ -166,7 +166,7 @@ begin
with CL.AddClassN(CL.FindClass('TPage'),'TTabSheet') do with CL.AddClassN(CL.FindClass('TPage'),'TTabSheet') do
begin begin
RegisterProperty('PageControl', 'TPageControl', iptrw); RegisterProperty('PageControl', 'TPageControl', iptrw);
RegisterProperty('TabIndex', 'Integer', iptrw); RegisterProperty('TabIndex', 'Integer', iptr);
RegisterProperty('OnMouseDown','TMouseEvent',iptrw); RegisterProperty('OnMouseDown','TMouseEvent',iptrw);
RegisterProperty('OnMouseMove','TMouseMoveEvent',iptrw); RegisterProperty('OnMouseMove','TMouseMoveEvent',iptrw);
RegisterProperty('OnMouseUp','TMouseEvent',iptrw); RegisterProperty('OnMouseUp','TMouseEvent',iptrw);
@ -434,8 +434,10 @@ procedure TPageControlActivePageIndex_R(Self: TPageControl; var T: Integer);
begin T := Self.ActivePageIndex; end; begin T := Self.ActivePageIndex; end;
(*----------------------------------------------------------------------------*) (*----------------------------------------------------------------------------*)
{$IFNDEF FPC}
procedure TTabSheetTabIndex_W(Self: TTabSheet; const T: Integer); procedure TTabSheetTabIndex_W(Self: TTabSheet; const T: Integer);
begin Self.TabIndex := T; end; begin Self.TabIndex := T; end;
{$ENDIF}
(*----------------------------------------------------------------------------*) (*----------------------------------------------------------------------------*)
procedure TTabSheetTabIndex_R(Self: TTabSheet; var T: Integer); procedure TTabSheetTabIndex_R(Self: TTabSheet; var T: Integer);
@ -671,7 +673,7 @@ begin
with CL.Add(TTabSheet) do with CL.Add(TTabSheet) do
begin begin
RegisterPropertyHelper(@TTabSheetPageControl_R,@TTabSheetPageControl_W,'PageControl'); RegisterPropertyHelper(@TTabSheetPageControl_R,@TTabSheetPageControl_W,'PageControl');
RegisterPropertyHelper(@TTabSheetTabIndex_R,@TTabSheetTabIndex_W,'TabIndex'); RegisterPropertyHelper(@TTabSheetTabIndex_R,nil,'TabIndex');
RegisterEventPropertyHelper(@TControlOnMouseDown_R,@TControlOnMouseDown_W,'OnMouseDown'); RegisterEventPropertyHelper(@TControlOnMouseDown_R,@TControlOnMouseDown_W,'OnMouseDown');
RegisterEventPropertyHelper(@TControlOnMouseMove_R,@TControlOnMouseMove_W,'OnMouseMove'); RegisterEventPropertyHelper(@TControlOnMouseMove_R,@TControlOnMouseMove_W,'OnMouseMove');
RegisterEventPropertyHelper(@TControlOnMouseUp_R,@TControlOnMouseUp_W,'OnMouseUp'); RegisterEventPropertyHelper(@TControlOnMouseUp_R,@TControlOnMouseUp_W,'OnMouseUp');