summaryrefslogtreecommitdiff
path: root/Make.lpr
blob: 493a8306ec24095b1720ec1a809ec4dfb308b479 (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,md,pd: string;
  lOpts,nonOpts:  tStringList;
begin
  lOpts:=tStringList.create;
  lOpts.add('Ausgabe:');
  lOpts.add('Datei:');
  lOpts.add('Prüfsummen:');
  lOpts.add('leise');
  lOpts.add('unsicher');
  lOpts.add('warten');
  nonOpts:=tStringList.create;
  errorMsg:=checkOptions('A:D:P:luw',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;

  if hasOption('D','Datei') then
    md:=getOptionValue('D','Datei')
  else
    md:='';

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

  mach:=tMach.create(md,pd,hasOption('w','warten'));

  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('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.