source: branches/Z80/Compiler.lpr

Last change on this file was 3, checked in by george, 15 years ago
  • Přidáno: Vývojová větev Void.
File size: 1.1 KB
Line 
1program Compiler;
2
3{$mode Delphi}{$H+}
4
5uses
6 {$IFDEF UNIX}{$IFDEF UseCThreads}
7 cthreads,
8 {$ENDIF}{$ENDIF}
9 Classes, SysUtils, UZ80Compiler, CustApp, UDynamicNumber;
10
11type
12 TCompilerApplication = class(TCustomApplication)
13 protected
14 procedure DoRun; override;
15 end;
16
17procedure TCompilerApplication.DoRun;
18var
19 Compiler: TZ80Compiler;
20 SourceCode: TStringList;
21 FileName: string;
22begin
23 Compiler := TZ80Compiler.Create;
24 with Compiler do begin
25 if HasOption('s', 'source') then begin
26 FileName := GetOptionValue('s', 'source');
27 SourceCode := TStringList.Create;
28 SourceCode.LoadFromFile(FileName);
29 Load(SourceCode);
30 SourceCode.Destroy;
31 end else begin
32 raise Exception.Create('Source file name not specified.');
33 end;
34 end;
35 Compiler.Destroy;
36 ReadLn;
37 Terminate;
38end;
39
40var
41 Application: TCompilerApplication;
42
43{$IFDEF WINDOWS}{$R Compiler.rc}{$ENDIF}
44
45begin
46 Application := TCompilerApplication.Create(nil);
47 with Application do begin
48 StopOnException := True;
49 Title := 'Z80 compiler';
50 Run;
51 Free;
52 end;
53end.
54
Note: See TracBrowser for help on using the repository browser.