Changeset 6 for branches/Void/project1.lpr
- Timestamp:
- Nov 9, 2009, 8:59:48 AM (15 years ago)
- Location:
- branches/Void
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Void
- Property svn:ignore
-
old new 6 6 project1.exe 7 7 *.dsk 8 *.~dsk
-
- Property svn:ignore
-
branches/Void/project1.lpr
r5 r6 1 1 program project1; 2 2 3 {$mode Delphi}{$H+}3 {$mode objfpc}{$H+} 4 4 5 5 uses … … 7 7 cthreads, 8 8 {$ENDIF}{$ENDIF} 9 Classes, SysUtils, CustApp, UCompilator; 10 11 type 12 13 { TApplication } 14 15 TApplication = class(TCustomApplication) 16 protected 17 procedure DoRun; override; 18 procedure CompilatorError(Text: string; var Terminate: Boolean); 19 public 20 Compilator: TCompilator; 21 constructor Create(TheOwner: TComponent); override; 22 destructor Destroy; override; 23 end; 24 25 { TApplication } 26 27 procedure TApplication.DoRun; 28 var 29 ErrorMsg: String; 30 begin 31 // quick check parameters 32 ErrorMsg := CheckOptions('h', 'help'); 33 if ErrorMsg <> '' then begin 34 ShowException(Exception.Create(ErrorMsg)); 35 Terminate; 36 Exit; 37 end; 38 39 Compilator := TCompilator.Create; 40 with Compilator do begin 41 OnError := CompilatorError; 42 Compile('Example.void'); 43 Destroy; 44 end; 45 ReadLn; 46 47 // stop program loop 48 Terminate; 49 end; 50 51 procedure TApplication.CompilatorError(Text: string; var Terminate: Boolean); 52 begin 53 Terminate := False; 54 WriteLn('Error: ' + Text); 55 end; 56 57 constructor TApplication.Create(TheOwner: TComponent); 58 begin 59 inherited Create(TheOwner); 60 StopOnException := True; 61 62 end; 63 64 destructor TApplication.Destroy; 65 begin 66 inherited Destroy; 67 end; 68 69 var 70 Application: TApplication; 9 Interfaces, // this includes the LCL widgetset 10 Forms, UMainForm, LResources 11 { you can add units after this }; 71 12 72 13 {$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} 73 14 74 15 begin 75 Application := TApplication.Create(nil); 76 Application.Title := 'Application'; 16 {$I project1.lrs} 17 Application.Initialize; 18 Application.CreateForm(TMainForm, MainForm); 77 19 Application.Run; 78 Application.Free;79 20 end. 80 21
Note:
See TracChangeset
for help on using the changeset viewer.