Last change
on this file was 16, checked in by george, 15 years ago |
- Upraveno: Rozdělení jednotek pro generování výstupů do samostatných souborů.
- Přidáno: Generátor kódu pro procesor Z80.
- Přidáno: Parsování celých čísel.
|
File size:
815 bytes
|
Line | |
---|
1 | unit UOutputGenerator;
|
---|
2 |
|
---|
3 | {$mode Delphi}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, UModel, StrUtils;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TOutputGenerator = class
|
---|
12 | private
|
---|
13 | public
|
---|
14 | Model: TModel;
|
---|
15 | IndentCount: Integer;
|
---|
16 | Output: TStringList;
|
---|
17 | function Indent: string;
|
---|
18 | procedure Generate(Model: TModel); virtual;
|
---|
19 | constructor Create;
|
---|
20 | destructor Destroy; override;
|
---|
21 | end;
|
---|
22 |
|
---|
23 | implementation
|
---|
24 |
|
---|
25 | { TOutputGenerator }
|
---|
26 |
|
---|
27 | function TOutputGenerator.Indent: string;
|
---|
28 | begin
|
---|
29 | Result := DupeString(' ', IndentCount);
|
---|
30 | end;
|
---|
31 |
|
---|
32 | procedure TOutputGenerator.Generate(Model: TModel);
|
---|
33 | begin
|
---|
34 | Self.Model := Model;
|
---|
35 | end;
|
---|
36 |
|
---|
37 | constructor TOutputGenerator.Create;
|
---|
38 | begin
|
---|
39 | Output := TStringList.Create;
|
---|
40 | end;
|
---|
41 |
|
---|
42 | destructor TOutputGenerator.Destroy;
|
---|
43 | begin
|
---|
44 | Output.Destroy;
|
---|
45 | inherited Destroy;
|
---|
46 | end;
|
---|
47 |
|
---|
48 | end.
|
---|
49 |
|
---|
50 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.