Ignore:
Timestamp:
Nov 9, 2009, 8:59:48 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Testování nyní prováděno přes oknovou aplikaci.
  • Přidáno: Podpora pro zobrazení řádku chyby.
Location:
branches/Void
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Void

    • Property svn:ignore
      •  

        old new  
        66project1.exe
        77*.dsk
         8*.~dsk
  • branches/Void/project1.lpr

    r5 r6  
    11program project1;
    22
    3 {$mode Delphi}{$H+}
     3{$mode objfpc}{$H+}
    44
    55uses
     
    77  cthreads,
    88  {$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 };
    7112
    7213{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
    7314
    7415begin
    75   Application := TApplication.Create(nil);
    76   Application.Title := 'Application';
     16  {$I project1.lrs}
     17  Application.Initialize;
     18  Application.CreateForm(TMainForm, MainForm);
    7719  Application.Run;
    78   Application.Free;
    7920end.
    8021
Note: See TracChangeset for help on using the changeset viewer.