| Line | |
|---|
| 1 | program Compiler;
|
|---|
| 2 |
|
|---|
| 3 | {$mode Delphi}{$H+}
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | {$IFDEF UNIX}{$IFDEF UseCThreads}
|
|---|
| 7 | cthreads,
|
|---|
| 8 | {$ENDIF}{$ENDIF}
|
|---|
| 9 | Classes, SysUtils, UZ80Compiler, CustApp, UDynamicNumber;
|
|---|
| 10 |
|
|---|
| 11 | type
|
|---|
| 12 | TCompilerApplication = class(TCustomApplication)
|
|---|
| 13 | protected
|
|---|
| 14 | procedure DoRun; override;
|
|---|
| 15 | end;
|
|---|
| 16 |
|
|---|
| 17 | procedure TCompilerApplication.DoRun;
|
|---|
| 18 | var
|
|---|
| 19 | Compiler: TZ80Compiler;
|
|---|
| 20 | SourceCode: TStringList;
|
|---|
| 21 | FileName: string;
|
|---|
| 22 | begin
|
|---|
| 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;
|
|---|
| 38 | end;
|
|---|
| 39 |
|
|---|
| 40 | var
|
|---|
| 41 | Application: TCompilerApplication;
|
|---|
| 42 |
|
|---|
| 43 | {$IFDEF WINDOWS}{$R Compiler.rc}{$ENDIF}
|
|---|
| 44 |
|
|---|
| 45 | begin
|
|---|
| 46 | Application := TCompilerApplication.Create(nil);
|
|---|
| 47 | with Application do begin
|
|---|
| 48 | StopOnException := True;
|
|---|
| 49 | Title := 'Z80 compiler';
|
|---|
| 50 | Run;
|
|---|
| 51 | Free;
|
|---|
| 52 | end;
|
|---|
| 53 | end.
|
|---|
| 54 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.