From e3d359b0884086620231eb70a9ed0f6c24e4715f Mon Sep 17 00:00:00 2001 From: Raymond Date: Tue, 18 May 2010 20:58:15 +0200 Subject: [PATCH] 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.. --- Projects/Simba/simbaunit.pas | 19 +++++++++++++------ Units/MMLAddon/mmlpsthread.pas | 6 +++--- Units/MMLCore/libloader.pas | 2 +- Units/Misc/CastaliaPasLex.pas | 6 +++++- Units/Misc/v_ideCodeInsight.pas | 4 +++- Units/PascalScript/uPSComponent.pas | 4 ++-- Units/PascalScript/uPSI_ComCtrls.pas | 6 ++++-- 7 files changed, 31 insertions(+), 16 deletions(-) diff --git a/Projects/Simba/simbaunit.pas b/Projects/Simba/simbaunit.pas index 65ee5fc..866bb9e 100644 --- a/Projects/Simba/simbaunit.pas +++ b/Projects/Simba/simbaunit.pas @@ -46,7 +46,7 @@ uses CastaliaSimplePasPar, v_AutoCompleteForm, PSDump; const - SimbaVersion = 670; + SimbaVersion = 675; type @@ -539,7 +539,12 @@ var b: TStringList; ms: TMemoryStream; begin - Index := PluginsGlob.LoadPlugin(LibName); + try + Index := PluginsGlob.LoadPlugin(LibName); + except + Result := false; + Index := -1; + end; if (Index < 0) then Exit(False) else @@ -2022,6 +2027,7 @@ var a: TPSScriptExtension; b: TStringList; ms: TMemoryStream; + buf : TCodeInsight; begin if SimbaForm.UpdatingFonts then begin @@ -2053,15 +2059,16 @@ begin CoreDefines.AddStrings(a.Defines); - SetLength(CoreBuffer, 1); - CoreBuffer[0] := TCodeInsight.Create; - with CoreBuffer[0] do + buf := TCodeInsight.Create; + with buf do begin OnMessage := @SimbaForm.OnCCMessage; b.SaveToStream(ms); Run(ms, nil, -1, True); FileName := '"PSCORE"'; end; + SetLength(CoreBuffer, 1); + CoreBuffer[0] := buf; finally b.Free; a.Free; @@ -2517,7 +2524,7 @@ begin if (NewPos <> OldPos) and (NewPos <> -1) then begin; Tabs.Move(OldPos,NewPos); - PageControl1.Pages[OldPos].TabIndex:= NewPos; + PageControl1.Pages[OldPos].PageIndex := NewPos; end; end; diff --git a/Units/MMLAddon/mmlpsthread.pas b/Units/MMLAddon/mmlpsthread.pas index 8a1b399..223e5cc 100644 --- a/Units/MMLAddon/mmlpsthread.pas +++ b/Units/MMLAddon/mmlpsthread.pas @@ -424,7 +424,7 @@ var path : string; begin result := false; - if CompareText(DirectiveName,'LOADDLL') = 0 then + if CompareText(DirectiveName,'LOADLIB') = 0 then begin if DirectiveArgs <> '' then begin; @@ -436,7 +436,7 @@ begin result:= True; end; 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 if CompareText(DirectiveName,'INCLUDE_ONCE') = 0 then begin @@ -598,7 +598,7 @@ procedure TPSThread.PSScriptProcessUnknowDirective(Sender: TPSPreProcessor; Parser: TPSPascalPreProcessorParser; const Active: Boolean; const DirectiveName, DirectiveParam: string; var Continue: Boolean); begin - Continue:= ProcessDirective(DirectiveName, DirectiveParam); + Continue:=not ProcessDirective(DirectiveName, DirectiveParam); end; function Muf_Conv_to_PS_Conv( conv : integer) : TDelphiCallingConvention; diff --git a/Units/MMLCore/libloader.pas b/Units/MMLCore/libloader.pas index fa65332..cfa7cac 100644 --- a/Units/MMLCore/libloader.pas +++ b/Units/MMLCore/libloader.pas @@ -133,7 +133,7 @@ implementation ii := i; end; 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 if Loaded[i].filename = (PluginDirs.Strings[ii] + PluginName + PlugExt) then Exit(i); diff --git a/Units/Misc/CastaliaPasLex.pas b/Units/Misc/CastaliaPasLex.pas index f0d7645..d596f83 100644 --- a/Units/Misc/CastaliaPasLex.pas +++ b/Units/Misc/CastaliaPasLex.pas @@ -1546,7 +1546,7 @@ begin FDirectiveParamOrigin := FOrigin + FTokenPos; FTokenPos := Run; case KeyHash of - 60: if KeyComp('LOADDLL') then + 55: if KeyComp('LOADLIB') then fTokenID := tokIncludeDirect else fTokenID := tokBorComment; @@ -2388,6 +2388,10 @@ begin if KeyComp('UNDEF') then Result := tokUndefDirect else Result := tokCompDirect; + 55: + if KeyComp('LOADLIB') then + result := tokIncludeDirect else + result := tokCompDirect; 56: if KeyComp('ELSEIF') then Result := tokElseIfDirect else diff --git a/Units/Misc/v_ideCodeInsight.pas b/Units/Misc/v_ideCodeInsight.pas index c7ff28c..74bb796 100644 --- a/Units/Misc/v_ideCodeInsight.pas +++ b/Units/Misc/v_ideCodeInsight.pas @@ -292,7 +292,7 @@ begin {$ENDIF} if (not Sender.IsJunk) and (Param <> '') then begin - p := Pos('loaddll', LowerCase(Sender.Token)); + p := Pos('loadlib', LowerCase(Sender.Token)); if (p > 0) and (p <= 3) then begin if LoadLibrary(Param) then @@ -1322,6 +1322,8 @@ procedure TCodeInsight.FillSynCompletionProposal(ItemList, InsertList: TStrings; var i: Integer; begin + if item = nil then + exit; if (not Item.Proposal_Filled) then Item.FillProposal; diff --git a/Units/PascalScript/uPSComponent.pas b/Units/PascalScript/uPSComponent.pas index efb9bab..5971e9e 100644 --- a/Units/PascalScript/uPSComponent.pas +++ b/Units/PascalScript/uPSComponent.pas @@ -447,7 +447,7 @@ procedure callObjectOnProcessDirective ( const DirectiveName, DirectiveParam: tbtstring; Var Continue: Boolean); begin - TPSScript (Sender.ID).DoOnProcessUnknowDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue); + TPSScript (Sender.ID).DoOnProcessDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue); end; procedure callObjectOnProcessUnknowDirective ( @@ -457,7 +457,7 @@ procedure callObjectOnProcessUnknowDirective ( const DirectiveName, DirectiveParam: tbtstring; Var Continue: Boolean); begin - TPSScript (Sender.ID).DoOnProcessDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue); + TPSScript (Sender.ID).DoOnProcessUnknowDirective(Sender, Parser, Active, DirectiveName, DirectiveParam, Continue); end; diff --git a/Units/PascalScript/uPSI_ComCtrls.pas b/Units/PascalScript/uPSI_ComCtrls.pas index da5a1a2..d6c6b61 100644 --- a/Units/PascalScript/uPSI_ComCtrls.pas +++ b/Units/PascalScript/uPSI_ComCtrls.pas @@ -166,7 +166,7 @@ begin with CL.AddClassN(CL.FindClass('TPage'),'TTabSheet') do begin RegisterProperty('PageControl', 'TPageControl', iptrw); - RegisterProperty('TabIndex', 'Integer', iptrw); + RegisterProperty('TabIndex', 'Integer', iptr); RegisterProperty('OnMouseDown','TMouseEvent',iptrw); RegisterProperty('OnMouseMove','TMouseMoveEvent',iptrw); RegisterProperty('OnMouseUp','TMouseEvent',iptrw); @@ -434,8 +434,10 @@ procedure TPageControlActivePageIndex_R(Self: TPageControl; var T: Integer); begin T := Self.ActivePageIndex; end; (*----------------------------------------------------------------------------*) +{$IFNDEF FPC} procedure TTabSheetTabIndex_W(Self: TTabSheet; const T: Integer); begin Self.TabIndex := T; end; +{$ENDIF} (*----------------------------------------------------------------------------*) procedure TTabSheetTabIndex_R(Self: TTabSheet; var T: Integer); @@ -671,7 +673,7 @@ begin with CL.Add(TTabSheet) do begin RegisterPropertyHelper(@TTabSheetPageControl_R,@TTabSheetPageControl_W,'PageControl'); - RegisterPropertyHelper(@TTabSheetTabIndex_R,@TTabSheetTabIndex_W,'TabIndex'); + RegisterPropertyHelper(@TTabSheetTabIndex_R,nil,'TabIndex'); RegisterEventPropertyHelper(@TControlOnMouseDown_R,@TControlOnMouseDown_W,'OnMouseDown'); RegisterEventPropertyHelper(@TControlOnMouseMove_R,@TControlOnMouseMove_W,'OnMouseMove'); RegisterEventPropertyHelper(@TControlOnMouseUp_R,@TControlOnMouseUp_W,'OnMouseUp');