From 13e5738b6104ca0b182c620fbfcbf1098de8709f Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Mon, 17 Apr 2023 11:54:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正namespace 代码跳转问题 --- designer/utslsynmemo.tsf | 80 ++++++++++++++++++++++++++++--------- designer/utslvcldebuger.tsf | 2 +- 2 files changed, 63 insertions(+), 19 deletions(-) diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index 4a08f7a..343ede5 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -1744,6 +1744,7 @@ type TTsfFileParser = class() // public function Create(); begin + FNsCaches := array(); fmsgcaches := array(); fiofs := ioFileseparator(); FCacheDir :=TS_GetUserProfileHome()+"TslSynMemo"+fiofs+"cmpCaches";// d["value"]; @@ -1771,6 +1772,10 @@ type TTsfFileParser = class() // begin return DirSet(d["value"]); end + "namespace": + begin + + end "getfinddirs": begin return FFindDirs; @@ -1797,17 +1802,35 @@ type TTsfFileParser = class() // end end private + function addnsfile(us); + begin + if not ifarray(us) then return array(); + r := us; + rl := length(r); + for i,v in us do + begin + for j,vj in FNsCaches[v] do + begin + if vj then + begin + r[rl++] := v+j; + end + end + end + return r; + end function getinheriteds(r,m,dounits,us,uso,cs,cso); begin 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 + for i,v in addnsfile(r["units"]) do begin - vfn := checknamespacename(v); + //vfn := checknamespacename(v); + vfn := v; if m=(lowercase(vfn)+".tsf") then continue; - vi := LoadByName(vfn); + vi := LoadByName(vfn); if vi then begin if vi["msg"] in dounits then @@ -1820,9 +1843,10 @@ type TTsfFileParser = class() // getinheriteds(vi,m,dounits,us,uso,cs,cso); end end - for i,v in r["class"] do + for i,v in addnsfile(r["class"]) do begin - vfn := checknamespacename(v); + vfn := v; + //vfn := checknamespacename(v); if m=(lowercase(vfn)+".tsf") then continue; vi := LoadByName(vfn); if vi then @@ -1911,16 +1935,17 @@ type TTsfFileParser = class() // //echo FFilePaths; if FFilePaths and not(FFilePaths[v]) then continue; //Ѿų wd := vv["functions"][0]; - if wd and ifarray(wd) and (wd0:=wd[0]) and wd0 and (v=lowercase(wd0)+vv["nspace"]+".tsf") then // + nns := vv["nspace"]; + if wd and ifarray(wd) and (wd0:=wd[0]) and wd0 and (v=lowercase(wd0)+nns+".tsf") then // begin - t := Formatfparams(wd)+" "+inttostr(vv["lines"][0]); + t := Formatfparams(wd)+" "+inttostr(vv["lines"][0]); d[idx]["value"]:= wd0; d[idx]["lvalue"] := lowercase(wd0); d[idx]["vlen"] := length(wd0); d[idx]["clen"] := length(t); d[idx]["jump"] := true; d[idx]["caption"] :=t; - d[idx]["file"] := wd0+vv["nspace"]; + d[idx]["file"] := wd0+nns; if od>=0 then d[idx]["order"] := od; d[idx]["line"] := vv["lines"][0]; idx++; @@ -1931,7 +1956,7 @@ type TTsfFileParser = class() // begin wd0 := vv["words"][0]; - if wd0 and ( (lowercase(wd0)+vv["nspace"]+".tsf")=v) then + if wd0 and ( (lowercase(wd0)+nns+".tsf")=v) then begin end else @@ -1939,11 +1964,11 @@ type TTsfFileParser = class() // d[idx]["value"]:= wd0; d[idx]["lvalue"] := lowercase(wd0); d[idx]["vlen"] := length(wd0); - t := wd0+" " ; + t := wd0+" " ; d[idx]["jump"] := true; d[idx]["caption"] := t; d[idx]["clen"] := length(t); - d[idx]["file"] := wd0+vv["nspace"]; + d[idx]["file"] := wd0+nns; d[idx]["line"] := 1; idx++; end @@ -2061,7 +2086,6 @@ type TTsfFileParser = class() // li := li .& 0x3FFFFFFF; end end - d[idx]["value"]:= v0; lvl := lowercase(v0); d[idx]["lvalue"]:= lvl; @@ -2128,7 +2152,7 @@ type TTsfFileParser = class() // begin fn := lowercase( v["FileName"]); if FFileNames[fn] then return ; - if fn=mf then return ; + //if fn=mf then return ; pfn := dir+fiofs+fn; sz := v["Size"]; flt := v["Time"]; @@ -2158,8 +2182,11 @@ type TTsfFileParser = class() // r["name"] := fn; if (aid := pos("@",fn)) then begin - r["nspace"] := fn[aid:(length(fn)-4)]; - r["name"] := fn[1:(aid-1)]; + nn := fn[1:(aid-1)]; + nns := fn[aid:(length(fn)-4)]; + r["nspace"] := nns; + r["name"] := nn; + FNsCaches[nn][nns] := 1; //echo "\r\nfn:",fn[aid:]; end else r["nspace"] := ""; r["msg"] := getmsgd_Crc32(rdd);//GetMsgdigest(rdd,0); @@ -2215,7 +2242,13 @@ type TTsfFileParser = class() // if FCacheDir then begin fn := FCacheDir+fiofs+"lasttime"+fiofs+ModifyFname(n)+".t"; - if importfile(ftstream(),"",fn,d)=1 then return d; + if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then + begin + nns := d["nspace"]; + nn := d["name"]; + FNsCaches[nn][nns] := 1; + return d; + end end end function ReadParseredFile(n,g); //ȡļ @@ -2242,6 +2275,14 @@ type TTsfFileParser = class() // end end end + function setnamespace(ns); + begin + if FNamespace<>ns then + begin + FNamespace := ns; + ClearCache(FFindDirs?true:false); + end + end function DirSet(d); // begin if not ifarray(d) then return FFindDirs; @@ -2250,7 +2291,7 @@ type TTsfFileParser = class() // FFinddirsseted := true; if ifarray(d) and d then begin - cl := FFindDirs?true:falsse; + cl := FFindDirs?true:false; FFindDirs := d; ClearCache(cl); end @@ -2265,6 +2306,7 @@ type TTsfFileParser = class() // FFileNames := array(); FFilePaths := array(); FCacheS := array(); + FNsCaches := array(); end function filechanged(d); begin @@ -2275,12 +2317,14 @@ type TTsfFileParser = class() // FFileWorker; FFilePaths; FCacheS; // + FNsCaches; FCacheblk; FFileNames; //ļ FCacheDir; //Ŀ¼ \β FCacheList;//Ŀ¼б //FCacheAbsFileName;//Ҫ - FFindDirs; //Ŀ¼ + FFindDirs; //Ŀ¼ + FNamespace; // fmsgcaches; function errtslcode(s); //ж function procedureβ㲻 diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index dea1fd6..9811f7c 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -981,7 +981,7 @@ type TTslDebuga=class(TCustomControl) end "DebugInfo": //Ϣ begin - if "dbgdetach"=remotewaitinit(d)then return; + if "dbgdetach"=remotewaitinit(d)then return; stk := magicgetarray(d,array("result","CmdData","CallStack")); // if fremotedbugstart then begin