Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Sep 15, 2023
1 parent d518ae9 commit 467ee87
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
7 changes: 5 additions & 2 deletions Source/codetools/simba.ide_codetools_parser.pas
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ TDeclaration = class({$IFDEF PARSER_LEAK_CHECKS}TLeakChecker{$ELSE}TObject{$EN

function IsName(const Value: String): Boolean; inline;

property Parser: TCodeParser read FParser;
property Lexer: TmwPasLex read FLexer;
property Owner: TDeclaration read FOwner;

Expand Down Expand Up @@ -335,8 +336,6 @@ TDeclaration_Parameter = class(TDeclaration_Var)
TFindPluginEvent = function(Sender: TmwBasePasLex; var FileName: string): Boolean of object;

TCodeParser = class(TmwSimplePasPar)
private
function GetFileName: String;
protected
FManagedItems: TDeclarationList;

Expand All @@ -357,6 +356,8 @@ TCodeParser = class(TmwSimplePasPar)
procedure FindLocals;
procedure FindGlobals;

function GetFileName: String;

// Hashes lexers filenames, fileage and defines.
function GetHash: String; virtual;

Expand Down Expand Up @@ -461,6 +462,8 @@ TCodeParser = class(TmwSimplePasPar)
constructor Create; override;
destructor Destroy; override;
end;
TPluginParser = class(TCodeParser);

TCodeParserArray = array of TCodeParser;
TCodeParserList = specialize TSimbaObjectList<TCodeParser>;

Expand Down
2 changes: 1 addition & 1 deletion Source/codetools/simba.ide_codetools_plugins.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ implementation
simba.ide_initialization, simba.ide_codetools_utils;

type
TCachedPlugin = class(TCodeParser)
TCachedPlugin = class(TPluginParser)
public
RefCount: Integer;
LastUsed: Integer;
Expand Down
1 change: 1 addition & 0 deletions Source/editor/simba.editor_autocomplete.pas
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ TColumnFormat = record
if Decl.isProcedure then Column := COLUMN_PROC else
if Decl.isType then Column := COLUMN_TYPE else
if Decl.isVar then Column := COLUMN_VAR else
if Decl.isField then Column := COLUMN_VAR else
if Decl.isConst then Column := COLUMN_CONST else
if Decl.isEnumElement then Column := COLUMN_ENUM else
if Decl.isKeyword then Column := COLUMN_KEYWORD else
Expand Down
4 changes: 1 addition & 3 deletions Source/simba.ide_showdeclaration.pas
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,14 @@ procedure ShowDeclaration(StartPos, EndPos, Line: Integer; FileName: String);

procedure ShowDeclaration(Declaration: TDeclaration);
begin
{
if Declaration.Lexer.IsLibrary then
if (Declaration.Parser is TPluginParser) then
begin
if (Declaration is TDeclaration_Method) then
SimbaDebugLn([EDebugLn.FOCUS], ['Declared internally in plugin: ' + Declaration.Lexer.FileName, TDeclaration_Method(Declaration).HeaderString])
else
SimbaDebugLn([EDebugLn.FOCUS], ['Declared internally in plugin: ' + Declaration.Lexer.FileName, Declaration.Text])
end
else
}
if (Declaration.Lexer.FileName = '') or FileExists(Declaration.Lexer.FileName) then
begin
if FileExists(Declaration.Lexer.FileName) then
Expand Down
2 changes: 2 additions & 0 deletions Source/simba.target.pas
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@ function TSimbaTarget.ToString: String;
Result := 'ETargetType.WINDOW: Handle=%d, Valid: %s'.Format([FTargetWindow, BoolToStr(IsValid(), True)]);
ETargetType.EIOS:
Result := 'ETargetType.EIOS: Target=%P'.Format([FTargetEIOS.Target]);
ETargetType.PLUGIN:
Result := 'ETargetType.PLUGIN: Filename="%s" Target=%P'.Format([FTargetPlugin.FileName, FTargetPlugin.Target]);
end;
end;

Expand Down
9 changes: 6 additions & 3 deletions Source/targets/simba.target_plugin.pas
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface
PSimbaPluginTarget = ^TSimbaPluginTarget;
TSimbaPluginTarget = record
Lib: TLibHandle;
FileName: String;
Target: Pointer;

Request: function(Args: PChar): Pointer; cdecl;
Expand Down Expand Up @@ -55,21 +56,23 @@ function PluginTarget_KeyPressed(Target: Pointer; Key: EKeyCode): Boolean;
implementation

uses
simba.script_pluginloader;
simba.env, simba.files, simba.script_pluginloader;

function Load(FileName: String): TSimbaPluginTarget;
function Load(AFileName: String): TSimbaPluginTarget;
begin
Result := Default(TSimbaPluginTarget);

with Result do
begin
try
Lib := LoadPlugin(FileName);
Lib := LoadPlugin(AFileName);
except
on E: Exception do
raise Exception.Create('LoadPluginTarget: ' + E.Message);
end;

FileName := TSimbaPath.PathExtractRelative(SimbaEnv.SimbaPath, AFileName);

Pointer(Request) := GetProcedureAddress(Lib, 'SimbaPluginTarget_Request');
Pointer(RequestWithDebugImage) := GetProcedureAddress(Lib, 'SimbaPluginTarget_RequestWithDebugImage');
Pointer(Release) := GetProcedureAddress(Lib, 'SimbaPluginTarget_Release');
Expand Down

0 comments on commit 467ee87

Please sign in to comment.