This file is indexed.

/usr/lib/lazarus/0.9.30.4/ideintf/ideexterntoolintf.pas is in lazarus-src-0.9.30.4 0.9.30.4-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
{ Copyright (C) 2006

 *****************************************************************************
 *                                                                           *
 *  See the file COPYING.modifiedLGPL.txt, included in this distribution,    *
 *  for details about the copyright.                                         *
 *                                                                           *
 *  This program is distributed in the hope that it will be useful,          *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
 *                                                                           *
 *****************************************************************************
 
  Author: Mattias Gaertner
}
unit IDEExternToolIntf;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LCLType, LazConfigStorage, Forms, Controls, BaseIDEIntf;

{ The xml format version:
    When the format changes (new values, changed formats) we can distinguish old
    files and are able to convert them.
}
const
  ExternalToolOptionsVersion = '2';

type
  TIDEExternalToolOptions = class;

  { TIDEScanMessageLine }

  TIDEScanMessageLine = class(TPersistent)
  private
    FCaller: TObject;
    FLine: string;
    FLineNumber: integer;
    FTool: TIDEExternalToolOptions;
    FWorkingDirectory: string;
    procedure SetLine(const AValue: string);
    procedure SetWorkingDirectory(const AValue: string);
  protected
    procedure SetTool(const AValue: TIDEExternalToolOptions);
    procedure SetLineNumber(const NewLineNumber: integer);
    procedure LineChanged(const OldValue: string); virtual; abstract;
    procedure WorkingDirectoryChanged(const OldValue: string); virtual; abstract;
  public
    constructor Create(TheCaller: TObject = nil; TheTool: TIDEExternalToolOptions = nil);
    property Caller: TObject read FCaller;
    property Line: string read FLine write SetLine;
    property WorkingDirectory: string read FWorkingDirectory write SetWorkingDirectory;
    property LineNumber: integer read FLineNumber;
    property Tool: TIDEExternalToolOptions read FTool;
  end;


  TOnIDEExtToolParseLine = procedure(Sender: TObject;
                                     Line: TIDEScanMessageLine) of object;

  {
    TIDEExternalToolOptions - the storage object for a single external tool
  }
  TIDEExternalToolOptions = class(TPersistent)
  private
    fCmdLineParams: string;
    FEnvironmentOverrides: TStringList;
    fFilename: string;
    FHideMainForm: boolean;
    FOnParseLine: TOnIDEExtToolParseLine;
    FScanners: TStrings;
    FScanOutput: boolean;
    fScanOutputForFPCMessages: boolean;
    fScanOutputForMakeMessages: boolean;
    FShowAllOutput: boolean;
    fTitle: string;
    fWorkingDirectory: string;
    procedure SetScanners(const AValue: TStrings);
    procedure SetScanOutput(const AValue: boolean);
    procedure SetShowAllOutput(const AValue: boolean);
  public
    constructor Create;
    destructor Destroy; override;
    procedure Assign(Source: TPersistent); override;
    procedure Clear; virtual;
    function NeedsOutputFilter: boolean;
    function Load(Config: TConfigStorage): TModalResult; virtual;
    function Save(Config: TConfigStorage): TModalResult; virtual;
    function ShortDescription: string;
    procedure AssignEnvironmentTo(Strings: TStrings);
    procedure ParseLine(Sender: TObject; Line: TIDEScanMessageLine); virtual;

    property CmdLineParams: string read fCmdLineParams write fCmdLineParams;
    property Filename: string read fFilename write fFilename;
    property Title: string read fTitle write fTitle;
    property WorkingDirectory: string
      read fWorkingDirectory write fWorkingDirectory;
    property EnvironmentOverrides: TStringList read FEnvironmentOverrides;
    property ScanOutputForFPCMessages: boolean
      read fScanOutputForFPCMessages write fScanOutputForFPCMessages;
    property ScanOutputForMakeMessages: boolean
      read fScanOutputForMakeMessages write fScanOutputForMakeMessages;
    property ScanOutput: boolean read FScanOutput write SetScanOutput;
    property ShowAllOutput: boolean read FShowAllOutput write SetShowAllOutput;
    property OnParseLine: TOnIDEExtToolParseLine read FOnParseLine write FOnParseLine;
    property Scanners: TStrings read FScanners write SetScanners;
    property HideMainForm: boolean read FHideMainForm write FHideMainForm default true;
  end;
  
type
  TRunExternalTool = function (Tool: TIDEExternalToolOptions): TModalResult of object;

var
  RunExternalTool: TRunExternalTool = nil;// set by the IDE

implementation

{ TIDEExternalToolOptions }

procedure TIDEExternalToolOptions.SetScanOutput(const AValue: boolean);
begin
  if FScanOutput=AValue then exit;
  FScanOutput:=AValue;
end;

procedure TIDEExternalToolOptions.SetScanners(const AValue: TStrings);
begin
  if FScanners=AValue then exit;
  FScanners.Assign(AValue);
end;

procedure TIDEExternalToolOptions.SetShowAllOutput(const AValue: boolean);
begin
  if FShowAllOutput=AValue then exit;
  FShowAllOutput:=AValue;
end;

procedure TIDEExternalToolOptions.Assign(Source: TPersistent);
var
  Src: TIDEExternalToolOptions;
begin
  if Source=Self then exit;
  if Source is TIDEExternalToolOptions then begin
    Src:=TIDEExternalToolOptions(Source);
    fTitle:=Src.fTitle;
    fFilename:=Src.fFilename;
    fCmdLineParams:=Src.fCmdLineParams;
    fWorkingDirectory:=Src.fWorkingDirectory;
    fScanOutputForFPCMessages:=Src.fScanOutputForFPCMessages;
    fScanOutputForMakeMessages:=Src.fScanOutputForMakeMessages;
    FScanOutput:=Src.FScanOutput;
    FShowAllOutput:=Src.FShowAllOutput;
    FScanners.Assign(Src.FScanners);
    FHideMainForm:=Src.HideMainForm;
  end else
    inherited Assign(Source);
end;

constructor TIDEExternalToolOptions.Create;
begin
  inherited Create;
  FEnvironmentOverrides:=TStringList.Create;
  FScanners:=TStringList.Create;
  FHideMainForm:=true;
  Clear;
end;

destructor TIDEExternalToolOptions.Destroy;
begin
  FreeAndNil(FEnvironmentOverrides);
  FreeAndNil(FScanners);
  inherited Destroy;
end;

procedure TIDEExternalToolOptions.Clear;
begin
  fTitle:='';
  fFilename:='';
  fCmdLineParams:='';
  fWorkingDirectory:='';
  fScanOutputForFPCMessages:=false;
  fScanOutputForMakeMessages:=false;
  FScanOutput:=false;
  FShowAllOutput:=false;
  FHideMainForm:=true;
  FEnvironmentOverrides.Clear;
  FScanners.Clear;
end;

function TIDEExternalToolOptions.Load(Config: TConfigStorage): TModalResult;
begin
  Clear;
  fTitle:=Config.GetValue('Title/Value','');
  fFilename:=Config.GetValue('Filename/Value','');
  fCmdLineParams:=Config.GetValue('CmdLineParams/Value','');
  fWorkingDirectory:=Config.GetValue('WorkingDirectory/Value','');
  fScanOutputForFPCMessages:=Config.GetValue(
                                        'ScanOutputForFPCMessages/Value',false);
  fScanOutputForMakeMessages:=Config.GetValue(
                                  'ScanOutputForMakeMessages/Value',false);
  FShowAllOutput:=Config.GetValue('ShowAllOutput/Value',false);
  FHideMainForm:=Config.GetValue('HideMainForm/Value',true);
  Config.GetValue('EnvironmentOverrides/',FEnvironmentOverrides);
  Config.GetValue('Scanners/',FScanners);
  Result:=mrOk;
end;

function TIDEExternalToolOptions.Save(Config: TConfigStorage): TModalResult;
begin
  Config.SetValue('Format/Version',ExternalToolOptionsVersion);
  Config.SetDeleteValue('Title/Value',fTitle,'');
  Config.SetDeleteValue('Filename/Value',fFilename,'');
  Config.SetDeleteValue('CmdLineParams/Value',fCmdLineParams,'');
  Config.SetDeleteValue('WorkingDirectory/Value',fWorkingDirectory,'');
  Config.SetDeleteValue(
               'ScanOutputForFPCMessages/Value',fScanOutputForFPCMessages,
               false);
  Config.SetDeleteValue(
             'ScanOutputForMakeMessages/Value',fScanOutputForMakeMessages,
             false);
  Config.SetDeleteValue('ShowAllOutput/Value',FShowAllOutput,false);
  Config.SetDeleteValue('HideMainForm/Value',FHideMainForm,true);
  Config.SetValue('EnvironmentOverrides/',FEnvironmentOverrides);
  Config.SetValue('Scanners/',FScanners);
  Result:=mrOk;
end;

function TIDEExternalToolOptions.ShortDescription: string;
begin
  Result:=Title;
end;

procedure TIDEExternalToolOptions.AssignEnvironmentTo(Strings: TStrings);
begin
  BaseIDEIntf.AssignEnvironmentTo(Strings,EnvironmentOverrides);
end;

procedure TIDEExternalToolOptions.ParseLine(Sender: TObject;
  Line: TIDEScanMessageLine);
begin
  if Assigned(OnParseLine) then
    OnParseLine(Sender,Line);
end;

function TIDEExternalToolOptions.NeedsOutputFilter: boolean;
begin
  Result:=ScanOutput
       or ScanOutputForFPCMessages or ScanOutputForMakeMessages
       or ShowAllOutput
       or ((FScanners<>nil) and (FScanners.Count>0));
end;

{ TIDEScanMessageLine }

procedure TIDEScanMessageLine.SetLine(const AValue: string);
var
  OldLine: String;
begin
  if FLine=AValue then exit;
  OldLine:=FLine;
  FLine:=AValue;
  LineChanged(OldLine);
end;

procedure TIDEScanMessageLine.SetWorkingDirectory(const AValue: string);
var
  OldDir: String;
begin
  if FWorkingDirectory=AValue then exit;
  OldDir:=FWorkingDirectory;
  FWorkingDirectory:=AValue;
  WorkingDirectoryChanged(OldDir);
end;

procedure TIDEScanMessageLine.SetTool(const AValue: TIDEExternalToolOptions);
begin
  FTool:=AValue;
end;

procedure TIDEScanMessageLine.SetLineNumber(const NewLineNumber: integer);
begin
  FLineNumber:=NewLineNumber;
end;

constructor TIDEScanMessageLine.Create(TheCaller: TObject;
  TheTool: TIDEExternalToolOptions);
begin
  FCaller:=TheCaller;
  FTool:=TheTool;
end;

end.