home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / SAMPLE / uObjLang.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-10  |  1KB  |  53 lines

  1. unit uObjLang;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Compiler,Code,ObjCodeGeneration;
  8.  
  9. type
  10.   TObjLang = class(TDataModule)
  11.     Compiler: TCompiler;
  12.     procedure CompilerOnR77(Sender: TCompiler; Bush: TBush);
  13.    private
  14.     { Private declarations }
  15.     g:TObjCodeGeneration;
  16.    public
  17.     { Public declarations }
  18.     function CompileTo(s:TStrings;c:TCode):boolean;
  19.   end;
  20.  
  21. var
  22.   ObjLang: TObjLang;
  23.  
  24. implementation
  25. {$R *.DFM}
  26. function  TObjLang.CompileTo;
  27.           begin
  28.             g:=TObjCodeGeneration.Create(c);
  29.             try
  30.               Compiler.BeginCompile;
  31.               Compiler.AcceptStrings(0,s);
  32.             except
  33.               Compiler.EndCompile;
  34.               g.Free;
  35.               raise;
  36.             end;
  37.             try
  38.               Compiler.EndCompile;
  39.             except
  40.               g.Free;
  41.               raise;
  42.             end;
  43.             g.Free;
  44.             Result:=not Compiler.WasErrors;
  45.           end;
  46.  
  47. procedure TObjLang.CompilerOnR77(Sender: TCompiler; Bush: TBush);
  48. begin
  49.   g.cBool(false);
  50. end;
  51.  
  52. end.
  53.