summaryrefslogtreecommitdiff
path: root/Make.lpr
blob: b0e6ff004375c0092fd2d0a2d45ec7caced48039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
program Make;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  classes, sysUtils, custApp
  { you can add units after this },
  lowlevelunit, dateiBeziehungen, systemunit;

type

  { tMake }

  tMake = class(tCustomApplication)
  protected
    procedure doRun; override;
  public
    constructor create(theOwner: tComponent); override;
  end;

{ tMake }

procedure tMake.doRun;
var
  mach:          tMach;
  errorMsg:      string;
  lOpts,nonOpts: tStringList;
begin
  lOpts:=tStringList.create;
  lOpts.add('Ausgabe:');
  lOpts.add('Datei:');
  lOpts.add('Prüfsummen:');
  lOpts.add('alleSummenErneuern');
  lOpts.add('leise');
  lOpts.add('unsicher');
  nonOpts:=tStringList.create;
  errorMsg:=checkOptions('A:D:P:alu',lOpts,nil,nonOpts,true);
  lOpts.free;
  while nonOpts.count>0 do begin
    if errorMsg<>'' then
      errorMsg:=errorMsg+#10;
    errorMsg:=errorMsg+'Überzähliges Argument '''+nonOpts[0]+'''!';
    nonOpts.delete(0);
  end;
  nonOpts.free;
  if errorMsg<>'' then
    fehler(errorMsg+#10'Hilfe: man Make');

  if hasOption('l','leise') then
    __ausgabenMaske:=3;

  mach:=tMach.create;

  if hasOption('D','Datei') then
    mach.machDatei:=getOptionValue('D','Datei')
  else
    mach.machDatei:='';

  if hasOption('P','Prüfsummen') then
    mach.pruefsummenDatei:=getOptionValue('P','Prüfsummen')
  else
    mach.pruefsummenDatei:='';

  gibAus('originale Regeln: '+inttostr(mach.anzOriAbh)+', originale Dateien: '+inttostr(mach.anzDats),3);
  mach.erzeugeRegeln;
  gibAus('Regeln: '+inttostr(mach.anzMglAbh)+', Dateien: '+inttostr(mach.anzDats),3);
  mach.findeWasZuTunIst;
  gibAus('anzuwendende Regeln: '+inttostr(mach.anzMglAbh),3);
  mach.tueWasZuTunIst(hasOption('a','alleSummenErneuern'),hasOption('u','unsicher'),getOptionValue('A','Ausgabe'));

  terminate;
end;

constructor tMake.create(theOwner: tComponent);
begin
  inherited create(theOwner);
  stopOnException:=True;
end;

var
  application: tMake;
begin
  __ausgabenMaske:=1;
  application:=tMake.create(nil);
  application.run;
  application.free;
end.