Changeset 40 for trunk/Target


Ignore:
Timestamp:
Feb 19, 2012, 2:13:49 PM (13 years ago)
Author:
chronos
Message:
  • Modified: Text message handling moved to UTarget unit as field of TTarget.
  • Modified: Messages are displayed as TListVIew rather then TMemo.
Location:
trunk/Target
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTarget.pas

    r39 r40  
    4747    procedure ClearSystem;
    4848    function SearchByTargetPos(Pos: Integer): TBreakPoint;
     49  end;
     50
     51  TMessage = class
     52    Text: string;
     53    Position: TPoint;
     54  end;
     55
     56  { TMessageList }
     57
     58  TMessageList = class(TListObject)
     59  private
     60    FOnChange: TNotifyEvent;
     61    procedure DoChange;
     62  public
     63    procedure AddMessage(Text: string);
     64    procedure AppendMessage(Text: string);
     65    property OnChange: TNotifyEvent read FOnChange write FOnChange;
    4966  end;
    5067
     
    7794    BreakPoints: TBreakPointList;
    7895    DebugSteps: TDebugStepList;
     96    Messages: TMessageList;
    7997    constructor Create; virtual;
    8098    destructor Destroy; override;
     99    procedure Reset; virtual;
    81100    procedure OptimizeSource;
    82101    procedure Compile; virtual;
     
    115134implementation
    116135
     136{ TMessageList }
     137
     138procedure TMessageList.DoChange;
     139begin
     140  if Assigned(FOnChange) then FOnChange(Self);
     141end;
     142
     143procedure TMessageList.AddMessage(Text: string);
     144var
     145  NewItem: TMessage;
     146begin
     147  NewItem := TMessage.Create;
     148  NewItem.Text := Text;
     149  Add(NewItem);
     150  DoChange;
     151end;
     152
     153procedure TMessageList.AppendMessage(Text: string);
     154begin
     155  if Count > 0 then begin
     156    TMessage(Last).Text := TMessage(Last).Text + Text;
     157    DoChange;
     158  end else AddMessage(Text);
     159end;
     160
    117161{ TBreakPointList }
    118162
     
    287331  BreakPoints := TBreakPointList.Create;
    288332  DebugSteps := TDebugStepList.Create;
     333  Messages := TMessageList.Create;
    289334end;
    290335
    291336destructor TTarget.Destroy;
    292337begin
     338  Messages.Free;
    293339  DebugSteps.Free;;
    294340  BreakPoints.Free;
    295341  inherited Destroy;
     342end;
     343
     344procedure TTarget.Reset;
     345begin
     346  Messages.Clear;
    296347end;
    297348
     
    359410procedure TTarget.Stop;
    360411begin
    361 
    362412end;
    363413
  • trunk/Target/UTargetInterpretter.pas

    r39 r40  
    4949    procedure CommandLoopStart;
    5050    procedure CommandLoopEnd;
    51     procedure Reset;
    5251    procedure PrepareBreakPoints;
    5352  protected
     
    6766    Input: string;
    6867    InputPosition: Integer;
     68    procedure Reset; override;
    6969    procedure Compile; override;
    7070    procedure Run; override;
     
    305305  I: Integer;
    306306begin
     307  inherited;
    307308  PrepareJumpTable;
    308309  SourcePosition := 0;
Note: See TracChangeset for help on using the changeset viewer.