unit dParmList;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, 
  Buttons, ExtCtrls, Grids;
                            
type
  TParmListDlg = class(TForm)
    OKBtn: TButton;
    StringGrid: TStringGrid;
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Params  : string;
  end;

var
  ParmListDlg: TParmListDlg;

implementation

{$R *.DFM}

const
  CR    = #13;
  LF    = #10;
  
procedure TParmListDlg.FormShow(Sender: TObject);
var st    : string;
    idx   : integer;

  Function GetParmString : string;
  begin
    result:= '';
    while (length(Params) >= idx) and (Params[idx] in[CR, LF, #0]) do begin
      inc(idx);
    end;
    while (length(Params) >= idx) and not(Params[idx] in[CR, LF, #0]) do begin
      result:= result + Params[idx];
      inc(idx);
    end;
    while (length(Params) >= idx) and (Params[idx] in[CR, LF, #0]) do begin
      inc(idx);
    end;
  end;

begin
  idx:= 1;
  st:= GetParmString;                                    // ProjectName;
  caption:= 'Parameter list of '+ st;
  StringGrid.Cells[0, 0]:= 'Project Name';
  StringGrid.Cells[1, 0]:= st;                           // ProjectName;

  StringGrid.Cells[0, 1]:= 'File created';
  StringGrid.Cells[1, 1]:= GetParmString;                // FileAge;

  StringGrid.Cells[0, 2]:= 'File downloaded';
  StringGrid.Cells[1, 2]:= GetParmString;                // CreateDate

  StringGrid.Cells[0, 3]:= 'CPU Name';
  StringGrid.Cells[1, 3]:= GetParmString;                // CPUName;

  StringGrid.Cells[0, 4]:= 'CPU Clock';
  StringGrid.Cells[1, 4]:= GetParmString;                // Clock

  StringGrid.Cells[0, 5]:= 'Flash to program';
  StringGrid.Cells[1, 5]:= GetParmString;                // FProgEnd

  StringGrid.Cells[0, 6]:= 'EEprom to program';
  StringGrid.Cells[1, 6]:= GetParmString;                // EProgEnd

  StringGrid.Cells[0, 7]:= 'Auto release target';
  StringGrid.Cells[1, 7]:= GetParmString;                // 'yes/no';

  StringGrid.Cells[0, 8]:= GetParmString;                // 'JTAG/SPI programming';
  StringGrid.Cells[1, 8]:= GetParmString;                // 'yes/no';

  StringGrid.Cells[0, 9]:= 'Target powered by';
  StringGrid.Cells[1, 9]:= GetParmString;                // 'Target itself or Voltage';

  StringGrid.SetFocus;
end;

end.


