forked from liujianjun/tslediter
编辑器
整理代码,以及优化编辑器提示
This commit is contained in:
@@ -3441,5 +3441,40 @@ E92946FC545E8EA1D20B8952E9954CA9F452AA3011854AAEE58A2A123445AF6A8
|
||||
1CB3C87955C3470000000049454E44AE42608200";
|
||||
return r ;
|
||||
end
|
||||
function GetPathFromFullName(fullname,fname,ftype);
|
||||
begin
|
||||
{**
|
||||
@explan(说明) 获得当前执行tsl文件的所在路径 %%
|
||||
@param(fullname)(string) 全名 %%
|
||||
@param(fname)(string) 文件名 ,变参返回%%
|
||||
@param(ftype)(string) 文件类型 ,变参返回%%
|
||||
@return(string) 路径 %%
|
||||
**}
|
||||
ph := fullname;
|
||||
n := "";
|
||||
rp := "";
|
||||
fname := "";
|
||||
ftype := "";
|
||||
firstd := true;
|
||||
iofp := ioFileseparator();
|
||||
for i := length(ph)downto 1 do
|
||||
begin
|
||||
vi := ph[i];
|
||||
if vi="." and firstd then
|
||||
begin
|
||||
ftype := n;
|
||||
n := "";
|
||||
firstd := false;
|
||||
end else
|
||||
if vi=iofp then
|
||||
begin
|
||||
rp := ph[1:i-1];
|
||||
break;
|
||||
end else
|
||||
n := vi+n;
|
||||
end
|
||||
FName := n;
|
||||
return rp;
|
||||
end
|
||||
|
||||
end.
|
||||
|
||||
+88
-160
@@ -1555,7 +1555,7 @@ type TTsfFileParser = class //
|
||||
//FFileWorker := new TThreadWorker("this.OnMessage :=findfunction('UTslSynMemo.FileSaveThreader') ;");
|
||||
FFindDirs := array();
|
||||
end
|
||||
|
||||
|
||||
function DispatchMethod(o,d);//分发消息
|
||||
begin
|
||||
if not ifarray(d) then return ;
|
||||
@@ -1596,130 +1596,37 @@ type TTsfFileParser = class //
|
||||
end
|
||||
"parserstring":
|
||||
begin
|
||||
rti := 0;
|
||||
rt := array();
|
||||
m := d["minus"];
|
||||
if ifstring(m) then m := lowercase(m);
|
||||
filechanged(m);
|
||||
FormatFile(rti,FCacheS,rt,3,m);
|
||||
|
||||
if m and ifarray(FCacheS) then
|
||||
begin
|
||||
r := FCacheS[m];
|
||||
end
|
||||
if r then
|
||||
begin
|
||||
//echo "\r\nlodad";
|
||||
vmsg := r["msg"];
|
||||
end else
|
||||
begin
|
||||
s := d["value"];
|
||||
if not(s and ifstring(s)) then return rt ;
|
||||
r := tsl_tokenizeex_2_(s,1);
|
||||
if not( r and ifarray(r)) then return rt;
|
||||
|
||||
cls := array();
|
||||
ScriptDelBlocks(r["blcks"],str2array(s,"\n"),cls);
|
||||
r["blcks"] := cls;
|
||||
vmsg := getmsgd_Crc32(s);//GetMsgdigest(s,0);
|
||||
end
|
||||
ext := array();
|
||||
FormatFunction(rti,r["functions"],rt,"",r["lines"],ext,1);
|
||||
FormatBlocks(rti,r["blcks"],rt,"",nil,ext,1);
|
||||
FormatWords(rti,r["words"],rt,"",ext,1);
|
||||
dounits := array(vmsg);
|
||||
uout := array();
|
||||
for i,v in r["units"] do //单元
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] =vmsg then
|
||||
begin
|
||||
continue;
|
||||
end
|
||||
ext := array();
|
||||
FormatFunction(rti,vi["functions"],rt,vfn,vi["lines"],ext,4);
|
||||
FormatBlocks(rti,vi["blcks"],rt,vfn,nil,ext,4);
|
||||
FormatWords(rti,vi["words"],rt,vfn,ext,4);
|
||||
dounits[length(dounits)] := vi["msg"];
|
||||
loadunits(vi["units"],dounits,uout);
|
||||
end
|
||||
end
|
||||
//mtic;
|
||||
for i,v in uout do
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] =vmsg then
|
||||
begin
|
||||
continue;
|
||||
end
|
||||
ext := array();
|
||||
FormatFunction(rti,vi["functions"],rt,vfn,vi["lines"],ext,4);
|
||||
end
|
||||
end
|
||||
uout := array();
|
||||
//echo "\r\n other time:",mtoc;
|
||||
dounits := array(vmsg);
|
||||
for i,v in r["class"] do //类
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] in dounits then continue;
|
||||
ext:= array();
|
||||
FormatFunction(rti,vi["functions"],rt,vfn,vi["lines"],ext,4);
|
||||
FormatWords(rti,vi["words"],rt,vfn,ext,4);
|
||||
//ident 文件名
|
||||
loadclasses(vi["class"],dounits,uout);
|
||||
end
|
||||
end
|
||||
for i,v in uout do
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"]=vmsg then continue;
|
||||
ext:= array();
|
||||
FormatFunction(rti,vi["functions"],rt,vfn,vi["lines"],ext,4);
|
||||
FormatWords(rti,vi["words"],rt,vfn,ext,4);
|
||||
end
|
||||
end
|
||||
//FormatFile(rti,FCacheS,rt,3,m);
|
||||
return rt;
|
||||
//return o.postmessage(r);
|
||||
mtic;
|
||||
r := parserstring(o,d);
|
||||
return r;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
private
|
||||
function loadunitcalss(us,cs,dounits,uout,cout);
|
||||
function getinheriteds(r,m,dounits,us,uso,cs,cso);
|
||||
begin
|
||||
if not ifarray(uout) then uout := array();
|
||||
if not ifarray(cout) then cout := array();
|
||||
for i,v in us do
|
||||
if not ifarray(us) then us := array();
|
||||
if not ifarray(uso) then uso := array();
|
||||
if not ifarray(cs) then cs := array();
|
||||
if not ifarray(cso) then cso := array();
|
||||
for i,v in r["units"] do
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] in dounits then continue;
|
||||
dounits[length(dounits)] := vi["msg"];
|
||||
uout[length(uout)] := vfn;
|
||||
loadunitcalss(vi["units"],vi["class"],dounits,uout,cout);
|
||||
end
|
||||
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] in dounits then
|
||||
begin
|
||||
continue;
|
||||
end
|
||||
dounits[length(dounits)] := vi["msg"] ;
|
||||
us[length(us)] := vfn;
|
||||
uso[length(uso)] := vi;
|
||||
getinheriteds(vi,m,dounits,us,uso,cs,cso);
|
||||
end
|
||||
end
|
||||
for i,v in cs do
|
||||
for i,v in r["class"] do
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
@@ -1728,48 +1635,68 @@ type TTsfFileParser = class //
|
||||
begin
|
||||
if vi["msg"] in dounits then continue;
|
||||
dounits[length(dounits)] := vi["msg"];
|
||||
//ident 文件名
|
||||
cout[length(cout)] := vfn;
|
||||
loadunitcalss(vi["units"],vi["class"],dounits,uout,cout);
|
||||
cs[length(cs)] := vfn;
|
||||
cso[length(cso)] := vi;
|
||||
getinheriteds(vi,m,dounits,us,uso,cs,cso);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
function loadunits(us,dounits,uout);
|
||||
function parserstring(o,d);
|
||||
begin
|
||||
if not ifarray(uout) then uout := array();
|
||||
for i,v in us do
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] in dounits then continue;
|
||||
dounits[length(dounits)] := vi["msg"];
|
||||
uout[length(uout)] := vfn;
|
||||
loadunits(vi["units"],dounits,uout);
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
function loadclasses(cs,dounits,uout);
|
||||
begin
|
||||
if not ifarray(uout) then uout := array();
|
||||
for i,v in cs do
|
||||
begin
|
||||
vfn := checknamespacename(v);
|
||||
if m=(lowercase(vfn)+".tsf") then continue;
|
||||
vi := LoadByName(vfn);
|
||||
if vi then
|
||||
begin
|
||||
if vi["msg"] in dounits then continue;
|
||||
dounits[length(dounits)] := vi["msg"];
|
||||
//ident 文件名
|
||||
uout[length(uout)] := vfn;
|
||||
loadclasses(cs,dounits,uout);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rti := 0;
|
||||
rt := array();
|
||||
m := d["minus"];
|
||||
if ifstring(m) then m := lowercase(m);
|
||||
filechanged(m);
|
||||
FormatFile(rti,FCacheS,rt,3,m);
|
||||
if m and ifarray(FCacheS) then
|
||||
begin
|
||||
r := FCacheS[m];
|
||||
end
|
||||
if r then
|
||||
begin
|
||||
//echo "\r\nlodad";
|
||||
vmsg := r["msg"];
|
||||
end else
|
||||
begin
|
||||
s := d["value"];
|
||||
if not(s and ifstring(s)) then return rt ;
|
||||
r := tsl_tokenizeex_2_(s,1);
|
||||
if not( r and ifarray(r)) then return rt;
|
||||
|
||||
cls := array();
|
||||
ScriptDelBlocks(r["blcks"],str2array(s,"\n"),cls);
|
||||
r["blcks"] := cls;
|
||||
vmsg := getmsgd_Crc32(s);//GetMsgdigest(s,0);
|
||||
end
|
||||
ext := array();
|
||||
FormatFunction(rti,r["functions"],rt,"",r["lines"],ext,1);
|
||||
FormatBlocks(rti,r["blcks"],rt,"",nil,ext,1);
|
||||
FormatWords(rti,r["words"],rt,"",ext,1);
|
||||
dounits := array(vmsg);
|
||||
getinheriteds(r,m,dounits,us,uso,cs,cso);
|
||||
for i,v in us do //单元
|
||||
begin
|
||||
vfn := v;
|
||||
vi := uso[i];
|
||||
ext := array();
|
||||
FormatFunction(rti,vi["functions"],rt,vfn,vi["lines"],ext,4);
|
||||
FormatBlocks(rti,vi["blcks"],rt,vfn,nil,ext,4);
|
||||
FormatWords(rti,vi["words"],rt,vfn,ext,4);
|
||||
end
|
||||
for i,v in cs do //类
|
||||
begin
|
||||
vfn := v;
|
||||
vi := cso[i];
|
||||
ext:= array();
|
||||
FormatFunction(rti,vi["functions"],rt,vfn,vi["lines"],ext,4);
|
||||
FormatWords(rti,vi["words"],rt,vfn,ext,4);
|
||||
end
|
||||
//FormatFile(rti,FCacheS,rt,3,m);
|
||||
return rt;
|
||||
//return o.postmessage(r);
|
||||
end
|
||||
function checknamespacename(v);
|
||||
begin
|
||||
for ii in FCacheS do
|
||||
@@ -2056,7 +1983,7 @@ type TTsfFileParser = class //
|
||||
ScriptDelBlocks(r["blcks"],str2array(rdd,"\n"),cls);
|
||||
r["blcks"] := cls;
|
||||
if not ifarray(FCacheS) then FCacheS := array();
|
||||
FCacheS[fn] := r;
|
||||
FCacheS[fn] := r;//new tparserdobject( r);
|
||||
FFilePaths[fn] := pfn;
|
||||
WriteParseredFile(fn,r,fl[0,"Time"]);
|
||||
end
|
||||
@@ -2102,7 +2029,7 @@ type TTsfFileParser = class //
|
||||
fn := FCacheDir+ioFileseparator()+ModifyFname(n)+".p";
|
||||
if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then
|
||||
begin
|
||||
FCacheS[lowercase(n)] := new tparserdobject(d);
|
||||
FCacheS[lowercase(n)] := r;//new tparserdobject(d);
|
||||
FFilePaths[lowercase(n)] := d["fullpath"];
|
||||
return d;
|
||||
end
|
||||
@@ -2157,6 +2084,7 @@ end
|
||||
type tparserdobject = class
|
||||
function create(d);
|
||||
begin
|
||||
echo "\r\n create f object===";
|
||||
if ifarray(d) then
|
||||
FData := d;
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user