(* Collection of code snippets by Arne Vajhøj *)
(* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) *)
program prep;

{$APPTYPE CONSOLE}

uses
  SysUtils;
  
var
  f1, f2 : text;
  line : string;
  n : integer;

begin
  assign(f1, ParamStr(1));
  assign(f2, ParamStr(2));
  reset(f1);
  rewrite(f2);
  n := 0;
  while not eof(f1) do begin
    inc(n);
    readln(f1, line);
    line := StringReplace(line, '__FILE__', '''' + ParamStr(1) + '''', [rfReplaceAll]);
    line := StringReplace(line, '__LINE__', '''' + IntToStr(n) + '''', [rfReplaceAll]);
    writeln(f2, line);
  end;
  close(f2);
  close(f1);
end.
