Changeset 19 for branches/DelphiToC/UCSource.pas
- Timestamp:
- Apr 9, 2009, 2:08:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/UCSource.pas
r14 r19 5 5 uses 6 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls, UPascalSource ;7 Dialogs, StdCtrls, UPascalSource, UCodeProducer; 8 8 9 9 type 10 TC Source = class10 TCProducer = class(TCodeProducer) 11 11 TextSource: TStringList; 12 PascalSource: TStringList; 13 procedure Generate; 12 procedure Produce; override; 14 13 constructor Create; 15 14 destructor Destroy; override; 15 private 16 procedure GenerateCommonBlock(CommonBlock: TCommonBlock; 17 LabelPrefix: string); 18 procedure GenerateProgram(ProgramBlock: TProgram); 16 19 end; 17 20 18 21 implementation 19 22 20 { TC Source}23 { TCProducer } 21 24 22 constructor TC Source.Create;25 constructor TCProducer.Create; 23 26 begin 24 27 TextSource := TStringList.Create; 25 28 end; 26 29 27 destructor TC Source.Destroy;30 destructor TCProducer.Destroy; 28 31 begin 29 32 TextSource.Free; … … 31 34 end; 32 35 33 procedure TC Source.Generate;36 procedure TCProducer.Produce; 34 37 begin 35 38 inherited; 39 GenerateProgram(ProgramCode); 36 40 end; 37 41 42 procedure TCProducer.GenerateProgram(ProgramBlock: TProgram); 43 var 44 I: Integer; 45 begin 46 with ProgramBlock do 47 for I := 0 to Modules.Count - 1 do 48 GenerateCommonBlock(TModule(Modules[I]), ''); 49 end; 50 51 procedure TCProducer.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string); 52 var 53 I: Integer; 54 LabelName: string; 55 begin 56 with CommonBlock do begin 57 TextSource.Add('void ' + Name + '()'); 58 TextSource.Add('{'); 59 60 TextSource.Add('}'); 61 end; 62 end; 63 64 65 38 66 end.
Note:
See TracChangeset
for help on using the changeset viewer.