Стартовый пул

This commit is contained in:
2024-04-02 08:46:59 +03:00
parent fd57fffd3a
commit 3bb34d000b
5591 changed files with 3291734 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Finder test"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General>
<i18n>
<EnableI18N LFM="False"/>
</i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="unit1.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fmMain"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../../atsynedit"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dUnicode"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@@ -0,0 +1,22 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
Application.Title:='Finder test';
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TfmMain, fmMain);
Application.Run;
end.

View File

@@ -0,0 +1,137 @@
object fmMain: TfmMain
Left = 516
Height = 320
Top = 250
Width = 667
BorderStyle = bsDialog
Caption = 'Test Finder.FindMatch'
ClientHeight = 320
ClientWidth = 667
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.5'
object Memo1: TMemo
Left = 8
Height = 48
Top = 24
Width = 407
Lines.Strings = (
'register'
)
TabOrder = 0
end
object Memo2: TMemo
Left = 8
Height = 216
Top = 96
Width = 407
Lines.Strings = (
'unit shapeline_reg;'
''
'interface'
''
'uses'
' SysUtils, Classes, Controls, LResources, shapeline;'
''
'procedure Register;'
''
'implementation'
''
'procedure Register;'
'begin'
' RegisterComponents(''Misc'', [TShapeLine]);'
'end;'
''
'initialization'
' {$I res/icons.lrs}'
''
'end.'
)
TabOrder = 1
end
object bFindNext: TButton
Left = 431
Height = 25
Top = 62
Width = 120
Caption = 'find next'
OnClick = bFindNextClick
TabOrder = 3
end
object bFind: TButton
Left = 431
Height = 25
Top = 30
Width = 120
Caption = 'find first'
OnClick = bFindClick
TabOrder = 2
end
object Label1: TLabel
Left = 8
Height = 17
Top = 7
Width = 62
Caption = 'find what'
ParentColor = False
end
object Label2: TLabel
Left = 8
Height = 17
Top = 80
Width = 70
Caption = 'find where'
ParentColor = False
end
object Memo3: TMemo
Left = 424
Height = 58
Top = 254
Width = 230
Lines.Strings = (
''
)
ReadOnly = True
TabOrder = 8
end
object chkBack: TCheckBox
Left = 431
Height = 24
Top = 174
Width = 92
Caption = 'backward'
TabOrder = 7
end
object chkCase: TCheckBox
Left = 431
Height = 24
Top = 126
Width = 89
Caption = 'case sens'
TabOrder = 5
end
object chkWords: TCheckBox
Left = 431
Height = 24
Top = 150
Width = 111
Caption = 'whole words'
TabOrder = 6
end
object Label3: TLabel
Left = 424
Height = 17
Top = 230
Width = 39
Caption = 'result'
ParentColor = False
end
object chkRegex: TCheckBox
Left = 431
Height = 24
Top = 102
Width = 64
Caption = 'regex'
TabOrder = 4
end
end

View File

@@ -0,0 +1,93 @@
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
atsynedit_finder, regexpr;
type
{ TfmMain }
TfmMain = class(TForm)
bFindNext: TButton;
bFind: TButton;
chkRegex: TCheckBox;
chkBack: TCheckBox;
chkCase: TCheckBox;
chkWords: TCheckBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
procedure bFindNextClick(Sender: TObject);
procedure bFindClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
Finder: TATTextFinder;
procedure DoFind(ANext: boolean);
{ private declarations }
public
{ public declarations }
end;
var
fmMain: TfmMain;
implementation
{$R *.lfm}
{ TfmMain }
procedure TfmMain.bFindClick(Sender: TObject);
begin
DoFind(false);
end;
procedure TfmMain.bFindNextClick(Sender: TObject);
begin
DoFind(true);
end;
procedure TfmMain.DoFind(ANext: boolean);
var
NFromPos, NSkipLen: integer;
begin
Finder.StrFind:= trim(Memo1.Text);
Finder.StrText:= trim(Memo2.Text);
Finder.OptCase:= chkCase.Checked;
Finder.OptWords:= chkWords.Checked;
Finder.OptBack:= chkBack.Checked;
Finder.OptRegex:= chkRegex.Checked;
NSkipLen:= Finder.MatchLen;
if ANext then
NFromPos:= Finder.MatchPos
else
if Finder.OptRegex then
NFromPos:= 1
else
if Finder.OptBack then
NFromPos:= Length(Finder.StrText)
else
NFromPos:= 1;
if not FInder.FindMatch(ANext, NSkipLen, NFromPos) then
memo3.text:= '(not found)'
else
memo3.text:= 'context:'#13+Copy(Finder.StrText, Finder.MatchPos-2, FInder.MatchLen+4);
end;
procedure TfmMain.FormCreate(Sender: TObject);
begin
FInder:= TATTextFinder.Create;
end;
end.