编辑器

优化代码
This commit is contained in:
JianjunLiu
2022-09-14 16:39:54 +08:00
parent 023c4eb967
commit a89d92ad42
4 changed files with 90 additions and 64 deletions
+8
View File
@@ -31,6 +31,14 @@ type tsgtkapi = class(tgtkapis)
function shell32DllGetVersion();
begin
end
function GetSystemMetrics(idx);
begin
global g_w_c_width;
case idx of
0x4 : return g_w_c_width;
end ;
return 24;
end
function GetCursorInfo_();
begin
end
+67
View File
@@ -2,6 +2,7 @@ unit utslvclauxiliary;
{**
@explan(说明) tslvcl 辅助库 %%
**}
//20220914 移入tire树
interface
function includestate(u,s);
function excludestate(u,s);
@@ -1628,6 +1629,72 @@ type TNode = class()
return FItems.Count;
end
end
type TTire = class
{**
@explan(说明) tire树
**}
type TTireNode = class
FChar;
FSub;
FEnd;
function Create(v);
begin
FChar := v;
FSub := array();
FEnd := false;
end
function Add(s);
begin
v0 := s[1];
vsub := FSub[v0];
if not vsub then
begin
vsub := new TTireNode(v0);
FSub[v0] := vsub;
end
ls := length(s);
if ls>1 then
vsub.Add(s[2:]);
else
begin
vsub.FEnd := true;
end
end
function Find(s,slen,idx);
begin
if idx>slen then return FEnd;
v0 := s[idx];
vsub := FSub[v0];
if vsub then
begin
idx++;
return vsub.Find(s,slen,idx);
end
return FEnd ;
end
end
function Add(s);
begin
FRoot.Add(s);
end
function Create();
begin
FRoot := new TTireNode();
end
function Find(s,slen,idx,outidx,ostr);
begin
tid := idx;
r := FRoot.Find(s,slen,idx);
if r then
begin
ostr := s[tid:idx-1];
outidx := idx;
end
idx := tid;
return r;
end
FRoot;
end
implementation
function includestate(u,s);
begin