unit utestpreprocesador;

interface

uses
{$IFDEF FPC-LCL}
        LResources,
{$ENDIF}

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, upreprocesador;

type
  TForm1 = class(TForm)
    Button1: TButton;
    eNombreVar: TEdit;
    eValorVar: TEdit;
    Button2: TButton;
    Memo1: TMemo;
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    listaVariablesPP: TListaDeVariablesPP;
  end;

var
  Form1: TForm1;

implementation
{$IFNDEF FPC-LCL}
{$R *.dfm}
{$ENDIF}


procedure TForm1.Button1Click(Sender: TObject);
var
  k: integer;
begin
  for k:= 0 to memo1.Lines.Count-1 do
  begin
    writeln( k:9,' ',memo1.Lines[k] );
    if k= 5 then
      writeln('-------------------');
    memo1.Lines[k]:= SustituirVariables( memo1.Lines[k], listaVariablesPP );
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  listaVariablesPP.Agregar( eNombreVar.Text, eValorVar.Text );
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  listaVariablesPP.Free;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   listaVariablesPP:= TListaDeVariablesPP.Create;
end;
initialization
{$IFDEF FPC-LCL}
  {$I utestpreprocesador.lrs}
{$ENDIF}

end.
