我创建使用PascalScript从的RemObjects(出色的)内置脚本引擎和SynEdit编辑器。它使用随PascalScript和SynEdit的IDE例如IDE例子差不多完成了 - 但是 - 我看不出怎么问PascalScript编号源行是否是“可执行文件”与否。 (我可以使用这个标记与“德尔福蓝点”的SynEdit装订线)。我想我可能要做的ROPS输出的dissassembly?

任何PascalScript专家在这里?谢谢。布赖恩。

有帮助吗?

解决方案

看一看创新安装的源代码。它示出了在SynEdit沟槽区域中的小点用于与可执行代码时,由于行灰色那些可执行但尚未执行的,绿色的已击中至少一次线行。

此的代码可以在CompForm.pas中找到,查找TLineState类型。该信息是建立在编译器回调的iscbNotifySuccess状态,你可以做同样的在你的IDE。您可能需要调整的代码来处理多个源文件,作为唯一的源文件中的代码片段的Inno Setup的编译器只涉及。

在Pascal脚本来源您应该看看TPSCustomDebugExec.TranslatePositionEx()方法 - 它不会返回源文件的名称,以及

其他提示

我不知道到底是怎么做的,但在PascalScript包中的IDE项目(下\样本\调试中)能够提供步骤进和跳过(F7和F8)功能,因此在逻辑上有有PS字节码与脚本代码行相关联的一些方法。尝试检查该项目,看看它是怎么做的。作为奖励,它采用SynEdit太多,所以思想会很容易适应自己的系统。

我知道这是一个老问题,但我一直在做同样的事情,我和上述建议没有真正的帮助。创新安装例如不使用Synedit,它使用火花编辑器。

另外,TPSCustomDebugExec.TranslatePositionEx()则相反什么是想要的,它给从运行时代码位置的源代码行号。

faffing有一段时间,我得出的结论是,最简单的方法是将函数添加到Pascalscript代码后。

新的方法加入到在uPSdebugger单元TPSCustomDebugExec类。

function TPSCustomDebugExec.HasCode(Filename:string; LineNo:integer):boolean;
var i,j:integer; fi:PFunctionInfo; pt:TIfList; r:PPositionData;
begin
  result:=false;
  for i := 0 to FDebugDataForProcs.Count -1 do
  begin
    fi := FDebugDataForProcs[i];
    pt := fi^.FPositionTable;
    for j := 0 to pt.Count -1 do
    begin
      r:=pt[j];
      result:= SameText(r^.FileName,Filename) and (r^.Row=LineNo);
      if result then exit
    end;
  end;
end;

和在主编辑器形式的涂料排水沟回调是如下

procedure Teditor.PaintGutterGlyphs(ACanvas:TCanvas; AClip:TRect;
  FirstLine, LastLine: integer);
var a,b:boolean; LH,LH2,X,Y,ImgIndex:integer;
begin
  begin
    FirstLine := Ed.RowToLine(FirstLine);
    LastLine := Ed.RowToLine(LastLine);
    X := 14;
    LH := Ed.LineHeight;
    LH2:=(LH-imglGutterGlyphs.Height) div 2;
    while FirstLine <= LastLine do
    begin
      Y := LH2+LH*(Ed.LineToRow(FirstLine)-Ed.TopLine);
      a:= ce.HasBreakPoint(ce.MainFileName,FirstLine);
      b:= ce.Exec.HasCode(ce.MainFileName,FirstLine);
      if Factiveline=FirstLine then
      begin
        if a then
          ImgIndex := 2   //Blue arrow+red dot (breakpoint and execution point)
        else
          ImgIndex := 1;  //Blue arrow (current line execution point)
      end
      else
        if b then
        begin
          if a then
            ImgIndex := 3  //Valid Breakpoint marker
          else
            ImgIndex := 0; //blue dot  (has code)
        end
        else
        begin
          if a then
            ImgIndex := 4  //Invalid breakpoint (No code on this line)
          else
            ImgIndex := -1; //Empty (No code for line)
        end;
      if ImgIndex >= 0 then
        imglGutterGlyphs.Draw(ACanvas, X,Y,ImgIndex);
      Inc(FirstLine);
    end;
  end;
end;

与行号,代码点,断点,书签和执行点看以下

在Synedit作为图像中

“在这里输入的图像描述”

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top