program Makecom2;{@..\UlanDef\ulanrecs.lst}
{$APPTYPE CONSOLE}
{$I define.pas}
(*
  writeln('Usage: MakeComp [@[pathXXXDef]UlanRecs.LST | XXXXType.pas]');
  writeln('Creates TxxObj object declaration/definition units xxxxOBJU.PAS');
  writeln('and objects' + '''' + ' editing form xxxxFRMU.PAS and xxxxFRMU.DFM');
  writeln('(use delphi convert program)');
  writeln('Using fields from "TxxxxRec = packed record" found in xxxxTYPE.PAS file ');
  writeln('xxxx is 1-4 uppercase chars. Ulan projects uses ULxx.');
  writeln('Generated sources use ULRecType.PAS, ULObju.PAS and IniObj.PAS');
*)
uses
  SysUtils,
  {
  SysUtils,
  Classes,
  Math,
  Windows,
  Stru,
  Attrib,
  AttrType,
  ULRecTyp,
  WinUtl,
  ULRecUtl,
  Graphics,
  ULObju,
  ULObjDes,
  }
  ULRecTyp,
  ULObjRWu in 'ULObjRWu.pas';

const

  Creator: TULObjRW = nil;
    { loads/parse all source XXXXType files, then creates all source
      .PAS, .DFM files }

procedure Help;
begin
  writeln('Usage: MakeCom2 [@[PathXXXX[Def]\]UlanRecs.lst | xxxxTYPE[.PAS] ]');
  writeln('Creates TxxxxObj object declaration/definition units xxxxOBJU.PAS,');
  writeln('objects' + '''' + ' editing form xxxxFRMU.PAS, xxxFRMU.DFM and');
  writeln('include files necessary for compiling ULFObju.pas file.');
  writeln('(Uses Delphi CONVERT.EXE program)');
  writeln('Using fields from "TxxxxRec = packed record" found in xxxxTYPE.PAS file.');
  writeln('xxxx is 1-4 uppercase chars. Ulan projects use ULxx.');
  writeln;
  writeln('If path of xxxxtype file specified then output will be made ');
  writeln('to the same directory. If the input path ends by "Def\" then ');
  writeln('the end is replaced by "Obj\" end the output will be made there.');
  writeln;
  writeln('If @file is specified as input, then the file will be');
  writeln('scanned for xxType.pas file names. Only lines that do not start');
  writeln('with space will be included to searching.');
  writeln('If the file name contains "Recs" string, then chars (xxx) before this word');
  writeln('will be used for including type file xxxType to all generated .pas files');
  writeln('uses section. If no "Recs" is in the file name, UlanType will be included.');
end;

begin
  if paramcount = 0 then
    Help
  else begin
    Creator := TULObjRW.Create('');
    try
      Creator.Run(paramstr(1));
      Creator.SaveToAsc;
      Creator.WriteDatabaseCreate;
    finally
      Creator.Free;
    end;
  end;
  writeln('Press Enter to finish.');
  readln;
end.
