Changeset 52 for branches/DelphiToC


Ignore:
Timestamp:
Aug 10, 2010, 7:57:46 AM (14 years ago)
Author:
george
Message:

Visual TreeView reprezentation moved into target code producer set.

Location:
branches/DelphiToC
Files:
3 added
3 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • branches/DelphiToC/DelphiToC.lpi

    r51 r52  
    4848        <TopLine Value="4"/>
    4949        <CursorPos X="1" Y="29"/>
    50         <UsageCount Value="113"/>
     50        <UsageCount Value="146"/>
    5151        <Loaded Value="True"/>
    5252      </Unit0>
     
    6060        <EditorIndex Value="6"/>
    6161        <WindowIndex Value="0"/>
    62         <TopLine Value="97"/>
    63         <CursorPos X="60" Y="112"/>
    64         <UsageCount Value="113"/>
     62        <TopLine Value="77"/>
     63        <CursorPos X="35" Y="87"/>
     64        <UsageCount Value="146"/>
    6565        <Loaded Value="True"/>
    6666        <LoadedDesigner Value="True"/>
     
    7373        <TopLine Value="1"/>
    7474        <CursorPos X="1" Y="1"/>
    75         <UsageCount Value="113"/>
     75        <UsageCount Value="146"/>
    7676      </Unit2>
    7777      <Unit3>
     
    8383        <TopLine Value="637"/>
    8484        <CursorPos X="13" Y="668"/>
    85         <UsageCount Value="113"/>
     85        <UsageCount Value="146"/>
    8686        <Loaded Value="True"/>
    8787      </Unit3>
     
    9494        <TopLine Value="1"/>
    9595        <CursorPos X="40" Y="16"/>
    96         <UsageCount Value="113"/>
     96        <UsageCount Value="146"/>
    9797        <Loaded Value="True"/>
    9898      </Unit4>
    9999      <Unit5>
    100         <Filename Value="Produce\UAssemblerSource.pas"/>
    101         <IsPartOfProject Value="True"/>
    102         <UnitName Value="UAssemblerSource"/>
     100        <Filename Value="Produce\UProducerAsm8051.pas"/>
     101        <IsPartOfProject Value="True"/>
     102        <UnitName Value="UProducerAsm8051"/>
    103103        <EditorIndex Value="9"/>
    104104        <WindowIndex Value="0"/>
    105         <TopLine Value="112"/>
    106         <CursorPos X="48" Y="128"/>
    107         <UsageCount Value="113"/>
     105        <TopLine Value="15"/>
     106        <CursorPos X="19" Y="28"/>
     107        <UsageCount Value="146"/>
    108108        <Loaded Value="True"/>
    109109      </Unit5>
    110110      <Unit6>
    111         <Filename Value="Produce\UCodeProducer.pas"/>
    112         <IsPartOfProject Value="True"/>
    113         <UnitName Value="UCodeProducer"/>
     111        <Filename Value="Produce\UProducer.pas"/>
     112        <IsPartOfProject Value="True"/>
     113        <UnitName Value="UProducer"/>
     114        <IsVisibleTab Value="True"/>
    114115        <EditorIndex Value="1"/>
    115116        <WindowIndex Value="0"/>
    116117        <TopLine Value="1"/>
    117         <CursorPos X="15" Y="13"/>
    118         <UsageCount Value="113"/>
     118        <CursorPos X="5" Y="13"/>
     119        <UsageCount Value="146"/>
    119120        <Loaded Value="True"/>
    120121      </Unit6>
     
    125126        <EditorIndex Value="10"/>
    126127        <WindowIndex Value="0"/>
    127         <TopLine Value="128"/>
    128         <CursorPos X="34" Y="141"/>
    129         <UsageCount Value="113"/>
     128        <TopLine Value="2"/>
     129        <CursorPos X="13" Y="15"/>
     130        <UsageCount Value="146"/>
    130131        <Loaded Value="True"/>
    131132      </Unit7>
     
    138139        <TopLine Value="1021"/>
    139140        <CursorPos X="1" Y="1026"/>
    140         <UsageCount Value="113"/>
     141        <UsageCount Value="146"/>
    141142        <Loaded Value="True"/>
    142143      </Unit8>
     
    147148        <TopLine Value="78"/>
    148149        <CursorPos X="14" Y="91"/>
    149         <UsageCount Value="55"/>
     150        <UsageCount Value="52"/>
    150151      </Unit9>
    151152      <Unit10>
     
    155156        <TopLine Value="1555"/>
    156157        <CursorPos X="1" Y="1"/>
    157         <UsageCount Value="4"/>
     158        <UsageCount Value="1"/>
    158159      </Unit10>
    159160      <Unit11>
     
    163164        <TopLine Value="61"/>
    164165        <CursorPos X="7" Y="68"/>
    165         <UsageCount Value="40"/>
     166        <UsageCount Value="56"/>
    166167        <Loaded Value="True"/>
    167168      </Unit11>
     
    172173        <TopLine Value="139"/>
    173174        <CursorPos X="16" Y="146"/>
    174         <UsageCount Value="40"/>
     175        <UsageCount Value="56"/>
    175176        <Loaded Value="True"/>
    176177      </Unit12>
     
    180181        <TopLine Value="934"/>
    181182        <CursorPos X="10" Y="947"/>
    182         <UsageCount Value="8"/>
     183        <UsageCount Value="5"/>
    183184      </Unit13>
    184185      <Unit14>
     
    187188        <TopLine Value="834"/>
    188189        <CursorPos X="11" Y="847"/>
    189         <UsageCount Value="4"/>
     190        <UsageCount Value="1"/>
    190191      </Unit14>
    191192      <Unit15>
     
    194195        <TopLine Value="153"/>
    195196        <CursorPos X="8" Y="166"/>
    196         <UsageCount Value="13"/>
     197        <UsageCount Value="10"/>
    197198      </Unit15>
    198199      <Unit16>
    199         <Filename Value="Visual\USourceTree.pas"/>
    200         <IsPartOfProject Value="True"/>
    201         <UnitName Value="USourceTree"/>
    202         <IsVisibleTab Value="True"/>
     200        <Filename Value="Produce\UProducerTreeView.pas"/>
     201        <IsPartOfProject Value="True"/>
     202        <UnitName Value="UProducerTreeView"/>
    203203        <EditorIndex Value="2"/>
    204204        <WindowIndex Value="0"/>
    205         <TopLine Value="254"/>
    206         <CursorPos X="41" Y="268"/>
    207         <UsageCount Value="75"/>
     205        <TopLine Value="1"/>
     206        <CursorPos X="20" Y="14"/>
     207        <UsageCount Value="108"/>
    208208        <Loaded Value="True"/>
    209209      </Unit16>
     
    214214        <TopLine Value="2656"/>
    215215        <CursorPos X="3" Y="2669"/>
    216         <UsageCount Value="4"/>
     216        <UsageCount Value="1"/>
    217217      </Unit17>
    218218      <Unit18>
     
    221221        <TopLine Value="559"/>
    222222        <CursorPos X="57" Y="571"/>
    223         <UsageCount Value="13"/>
     223        <UsageCount Value="10"/>
    224224      </Unit18>
    225225      <Unit19>
     
    231231        <TopLine Value="1"/>
    232232        <CursorPos X="23" Y="9"/>
    233         <UsageCount Value="30"/>
     233        <UsageCount Value="62"/>
    234234        <Loaded Value="True"/>
    235235      </Unit19>
     
    238238      <Position1>
    239239        <Filename Value="Analyze\UParser.pas"/>
    240         <Caret Line="1006" Column="1" TopLine="992"/>
     240        <Caret Line="1001" Column="28" TopLine="988"/>
    241241      </Position1>
    242242      <Position2>
    243243        <Filename Value="Analyze\UParser.pas"/>
    244         <Caret Line="1004" Column="9" TopLine="991"/>
     244        <Caret Line="1024" Column="57" TopLine="1011"/>
    245245      </Position2>
    246246      <Position3>
    247247        <Filename Value="Analyze\UParser.pas"/>
    248         <Caret Line="1013" Column="16" TopLine="1002"/>
     248        <Caret Line="1022" Column="45" TopLine="1009"/>
    249249      </Position3>
    250250      <Position4>
    251251        <Filename Value="Analyze\UParser.pas"/>
    252         <Caret Line="1021" Column="14" TopLine="1008"/>
     252        <Caret Line="1030" Column="39" TopLine="1017"/>
    253253      </Position4>
    254254      <Position5>
    255255        <Filename Value="Analyze\UParser.pas"/>
    256         <Caret Line="1024" Column="35" TopLine="1010"/>
     256        <Caret Line="1031" Column="41" TopLine="1018"/>
    257257      </Position5>
    258258      <Position6>
    259259        <Filename Value="Analyze\UParser.pas"/>
    260         <Caret Line="1029" Column="21" TopLine="1016"/>
     260        <Caret Line="1067" Column="63" TopLine="1051"/>
    261261      </Position6>
    262262      <Position7>
    263263        <Filename Value="Analyze\UParser.pas"/>
    264         <Caret Line="1011" Column="33" TopLine="1010"/>
     264        <Caret Line="1058" Column="54" TopLine="1045"/>
    265265      </Position7>
    266266      <Position8>
    267         <Filename Value="Analyze\UParser.pas"/>
    268         <Caret Line="67" Column="45" TopLine="54"/>
     267        <Filename Value="Forms\UMainForm.pas"/>
     268        <Caret Line="112" Column="60" TopLine="97"/>
    269269      </Position8>
    270270      <Position9>
    271         <Filename Value="Analyze\UParser.pas"/>
    272         <Caret Line="1001" Column="28" TopLine="988"/>
     271        <Filename Value="Forms\UMainForm.pas"/>
     272        <Caret Line="111" Column="60" TopLine="96"/>
    273273      </Position9>
    274274      <Position10>
    275         <Filename Value="Analyze\UParser.pas"/>
    276         <Caret Line="1024" Column="57" TopLine="1011"/>
     275        <Filename Value="Produce\UProducer.pas"/>
     276        <Caret Line="11" Column="11" TopLine="1"/>
    277277      </Position10>
    278278      <Position11>
    279         <Filename Value="Analyze\UParser.pas"/>
    280         <Caret Line="1022" Column="45" TopLine="1009"/>
     279        <Filename Value="Forms\UMainForm.pas"/>
     280        <Caret Line="111" Column="60" TopLine="96"/>
    281281      </Position11>
    282282      <Position12>
    283         <Filename Value="Analyze\UParser.pas"/>
    284         <Caret Line="1030" Column="39" TopLine="1017"/>
     283        <Filename Value="Produce\UProducerTreeView.pas"/>
     284        <Caret Line="36" Column="16" TopLine="17"/>
    285285      </Position12>
    286286      <Position13>
    287         <Filename Value="Analyze\UParser.pas"/>
    288         <Caret Line="1031" Column="41" TopLine="1018"/>
     287        <Filename Value="Produce\UProducerTreeView.pas"/>
     288        <Caret Line="35" Column="1" TopLine="23"/>
    289289      </Position13>
    290290      <Position14>
    291         <Filename Value="Analyze\UParser.pas"/>
    292         <Caret Line="1067" Column="63" TopLine="1051"/>
     291        <Filename Value="Forms\UMainForm.pas"/>
     292        <Caret Line="84" Column="35" TopLine="71"/>
    293293      </Position14>
    294294      <Position15>
    295         <Filename Value="Analyze\UParser.pas"/>
    296         <Caret Line="1058" Column="54" TopLine="1045"/>
     295        <Filename Value="Forms\UMainForm.pas"/>
     296        <Caret Line="86" Column="42" TopLine="66"/>
    297297      </Position15>
    298298      <Position16>
    299         <Filename Value="Visual\USourceTree.pas"/>
    300         <Caret Line="207" Column="1" TopLine="193"/>
     299        <Filename Value="Forms\UMainForm.pas"/>
     300        <Caret Line="9" Column="7" TopLine="1"/>
    301301      </Position16>
    302302      <Position17>
    303         <Filename Value="Visual\USourceTree.pas"/>
    304         <Caret Line="22" Column="30" TopLine="9"/>
     303        <Filename Value="Produce\UProducerTreeView.pas"/>
     304        <Caret Line="14" Column="9" TopLine="7"/>
    305305      </Position17>
    306306      <Position18>
    307         <Filename Value="Visual\USourceTree.pas"/>
    308         <Caret Line="208" Column="1" TopLine="193"/>
     307        <Filename Value="Forms\UMainForm.pas"/>
     308        <Caret Line="84" Column="39" TopLine="71"/>
    309309      </Position18>
    310310      <Position19>
    311         <Filename Value="Visual\USourceTree.pas"/>
    312         <Caret Line="22" Column="70" TopLine="9"/>
     311        <Filename Value="Forms\UMainForm.pas"/>
     312        <Caret Line="88" Column="1" TopLine="81"/>
    313313      </Position19>
    314314      <Position20>
    315         <Filename Value="Visual\USourceTree.pas"/>
    316         <Caret Line="207" Column="74" TopLine="195"/>
     315        <Filename Value="Forms\UMainForm.pas"/>
     316        <Caret Line="86" Column="57" TopLine="73"/>
    317317      </Position20>
    318318      <Position21>
    319         <Filename Value="Visual\USourceTree.pas"/>
    320         <Caret Line="22" Column="15" TopLine="10"/>
     319        <Filename Value="Forms\UMainForm.pas"/>
     320        <Caret Line="85" Column="57" TopLine="72"/>
    321321      </Position21>
    322322      <Position22>
    323         <Filename Value="Visual\USourceTree.pas"/>
    324         <Caret Line="208" Column="16" TopLine="195"/>
     323        <Filename Value="Forms\UMainForm.pas"/>
     324        <Caret Line="99" Column="69" TopLine="75"/>
    325325      </Position22>
    326326      <Position23>
    327         <Filename Value="Visual\USourceTree.pas"/>
    328         <Caret Line="22" Column="73" TopLine="9"/>
     327        <Filename Value="Forms\UMainForm.pas"/>
     328        <Caret Line="65" Column="31" TopLine="52"/>
    329329      </Position23>
    330330      <Position24>
    331         <Filename Value="Visual\USourceTree.pas"/>
    332         <Caret Line="208" Column="46" TopLine="195"/>
     331        <Filename Value="Forms\UMainForm.pas"/>
     332        <Caret Line="76" Column="31" TopLine="63"/>
    333333      </Position24>
    334334      <Position25>
    335         <Filename Value="Visual\USourceTree.pas"/>
    336         <Caret Line="253" Column="77" TopLine="241"/>
     335        <Filename Value="Forms\UMainForm.pas"/>
     336        <Caret Line="77" Column="11" TopLine="64"/>
    337337      </Position25>
    338338      <Position26>
    339         <Filename Value="Visual\USourceTree.pas"/>
    340         <Caret Line="261" Column="17" TopLine="248"/>
     339        <Filename Value="Forms\UMainForm.pas"/>
     340        <Caret Line="87" Column="31" TopLine="74"/>
    341341      </Position26>
    342342      <Position27>
    343         <Filename Value="Visual\USourceTree.pas"/>
    344         <Caret Line="268" Column="32" TopLine="250"/>
     343        <Filename Value="Forms\UMainForm.pas"/>
     344        <Caret Line="98" Column="31" TopLine="85"/>
    345345      </Position27>
    346346      <Position28>
    347         <Filename Value="Visual\USourceTree.pas"/>
    348         <Caret Line="267" Column="13" TopLine="254"/>
     347        <Filename Value="Produce\UProducerC.pas"/>
     348        <Caret Line="128" Column="17" TopLine="128"/>
    349349      </Position28>
    350350      <Position29>
    351         <Filename Value="Visual\USourceTree.pas"/>
    352         <Caret Line="266" Column="74" TopLine="254"/>
     351        <Filename Value="Produce\UProducerC.pas"/>
     352        <Caret Line="15" Column="5" TopLine="2"/>
    353353      </Position29>
    354354      <Position30>
    355         <Filename Value="Visual\USourceTree.pas"/>
    356         <Caret Line="267" Column="48" TopLine="254"/>
     355        <Filename Value="Produce\UProducerAsm8051.pas"/>
     356        <Caret Line="103" Column="22" TopLine="97"/>
    357357      </Position30>
    358358    </JumpHistory>
  • branches/DelphiToC/DelphiToC.lpr

    r51 r52  
    1212  USourceCode,
    1313  UCompiler,
    14   UAssemblerSource in 'Produce\UAssemblerSource.pas',
    15   UCodeProducer in 'Produce\UCodeProducer.pas',
     14  UProducerAsm8051,
     15  UProducer,
    1616  UProducerC, UProducerPascal,
    17   UParser, USourceTree;
     17  UParser, UProducerTreeView;
    1818
    1919{$R *.res}
  • branches/DelphiToC/Forms/UMainForm.lfm

    r51 r52  
    11object MainForm: TMainForm
    2   Left = 273
     2  Left = 176
    33  Height = 498
    4   Top = 105
     4  Top = 77
    55  Width = 881
    66  Caption = 'Pascal Compiler AVR'
     
    2525    TabOrder = 0
    2626  end
    27   object Memo2: TMemo
    28     Left = 672
    29     Height = 363
    30     Top = 32
    31     Width = 203
    32     Anchors = [akTop, akLeft, akRight, akBottom]
    33     Font.Height = -13
    34     Font.Name = 'Lucida Console'
    35     ParentFont = False
    36     ScrollBars = ssBoth
    37     TabOrder = 1
    38   end
    39   object TreeView1: TTreeView
    40     Left = 368
    41     Height = 387
    42     Top = 8
    43     Width = 296
    44     Anchors = [akTop, akLeft, akBottom]
    45     DefaultItemHeight = 15
    46     Indent = 19
    47     TabOrder = 2
    48   end
    4927  inline SynEdit1: TSynEdit
    5028    Left = 8
    5129    Height = 388
    5230    Top = 8
    53     Width = 352
     31    Width = 488
    5432    Anchors = [akTop, akLeft, akBottom]
    5533    Font.Height = -13
     
    5937    ParentColor = False
    6038    ParentFont = False
    61     TabOrder = 3
     39    TabOrder = 1
    6240    Gutter.Width = 57
    6341    Gutter.MouseActions = <   
     
    742720  end
    743721  object ComboBox1: TComboBox
    744     Left = 672
     722    Left = 504
    745723    Height = 21
    746724    Top = 8
    747     Width = 205
     725    Width = 373
    748726    Anchors = [akTop, akLeft, akRight]
    749727    ItemHeight = 13
     
    753731      'C'
    754732      'i8051'
     733      'TreeView'
    755734    )
    756735    OnChange = ComboBox1Change
    757736    Style = csDropDownList
    758     TabOrder = 4
     737    TabOrder = 2
    759738    Text = 'Pascal'
    760739  end
     
    767746    ItemHeight = 0
    768747    OnClick = ListBox1Click
    769     TabOrder = 5
     748    TabOrder = 3
     749  end
     750  object Panel1: TPanel
     751    Left = 504
     752    Height = 354
     753    Top = 40
     754    Width = 372
     755    Anchors = [akTop, akLeft, akRight, akBottom]
     756    BevelOuter = bvNone
     757    TabOrder = 4
    770758  end
    771759  object SynPasSyn1: TSynPasSyn
  • branches/DelphiToC/Forms/UMainForm.pas

    r51 r52  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, StdCtrls, USourceCode, UCompiler, UAssemblerSource,
    10   UProducerC, ComCtrls, SynEdit, SynHighlighterPas, USourceTree,
     9  Dialogs, StdCtrls, USourceCode, UCompiler, UProducerAsm8051,
     10  UProducerC, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, UProducerTreeView,
    1111  UProducerPascal, Contnrs;
    1212
     
    2121    ComboBox1: TComboBox;
    2222    ListBox1: TListBox;
    23     Memo2: TMemo;
     23    Panel1: TPanel;
    2424    SynEdit1: TSynEdit;
    2525    SynPasSyn1: TSynPasSyn;
    26     TreeView1: TTreeView;
    2726    procedure ComboBox1Change(Sender: TObject);
    2827    procedure FormShow(Sender: TObject);
     
    3534  private
    3635  public
     36    ProducerControl: TControl;
    3737    Compiler: TCompiler;
    38     SourceTree: TSourceTree;
     38    SourceTree: TProducerTreeView;
    3939  end;
    4040
     
    5555  Compiler.SourceCode.Assign(SynEdit1.Lines);
    5656
    57   Memo2.Clear;
     57  ProducerControl.Free;
    5858  if ComboBox1.ItemIndex = 0 then begin
    5959    Compiler.Producer.Free;
     
    6161    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
    6262    Compiler.Compile;
     63    ProducerControl := TMemo.Create(Self);
     64    ProducerControl.Parent := Panel1;
     65    ProducerControl.Align := alClient;
    6366    with TProducerPascal(Compiler.Producer) do
    64       Memo2.Lines.Assign(TextSource);
     67      TMemo(ProducerControl).Lines.Assign(TextSource);
    6568  end else
    6669  if ComboBox1.ItemIndex = 1 then begin
    6770    Compiler.Producer.Free;
    68     Compiler.Producer := TCProducer.Create;
     71    Compiler.Producer := TProducerC.Create;
    6972    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
    7073    Compiler.Compile;
    71     with TCProducer(Compiler.Producer) do
    72       Memo2.Lines.Assign(TextSource);
     74    ProducerControl := TMemo.Create(Self);
     75    ProducerControl.Parent := Panel1;
     76    ProducerControl.Align := alClient;
     77    with TProducerC(Compiler.Producer) do
     78      TMemo(ProducerControl).Lines.Assign(TextSource);
    7379  end else
    7480  if ComboBox1.ItemIndex = 2 then begin
    7581    Compiler.Producer.Free;
    76     Compiler.Producer := TAssemblerProducer.Create;
     82    Compiler.Producer := TProducerAsm8051.Create;
    7783    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
    7884    Compiler.Compile;
    79     with TAssemblerProducer(Compiler.Producer) do
     85    ProducerControl := TMemo.Create(Self);
     86    ProducerControl.Parent := Panel1;
     87    ProducerControl.Align := alClient;
     88    with TProducerAsm8051(Compiler.Producer) do
    8089    for I := 0 to AssemblyCode.Count - 1 do
    81       Memo2.Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString);
     90      TMemo(ProducerControl).Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString);
     91  end;
     92  if ComboBox1.ItemIndex = 3 then begin
     93    Compiler.Producer.Free;
     94    Compiler.Producer := TProducerTreeView.Create;
     95    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
     96    ProducerControl := TTreeView.Create(Self);
     97    ProducerControl.Parent := Panel1;
     98    ProducerControl.Align := alClient;
     99    TProducerTreeView(Compiler.Producer).TreeView := TTreeView(ProducerControl);
     100    Compiler.Compile;
    82101  end;
    83102  LoadErrorMessages;
    84 
    85   SourceTree.TreeView := TreeView1;
    86   SourceTree.Code := Compiler.ProgramCode;
    87   SourceTree.Fill;
    88103end;
    89104
     
    115130begin
    116131  Compiler := TCompiler.Create;
    117   SourceTree := TSourceTree.Create;
     132  SourceTree := TProducerTreeView.Create;
    118133end;
    119134
  • branches/DelphiToC/Produce/UProducerC.pas

    r51 r52  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, StdCtrls, USourceCode, UCodeProducer, StrUtils;
     9  Dialogs, StdCtrls, USourceCode, UProducer, StrUtils;
    1010
    1111type
    1212
    13   { TCProducer }
    14 
    15   TCProducer = class(TCodeProducer)
     13  { TProducerC }
     14
     15  TProducerC = class(TProducer)
    1616  private
    1717    function TranslateType(Name: string): string;
     
    4242implementation
    4343
    44 { TCProducer }
    45 
    46 constructor TCProducer.Create;
     44{ TProducerC }
     45
     46constructor TProducerC.Create;
    4747begin
    4848  TextSource := TStringList.Create;
     
    5050end;
    5151
    52 destructor TCProducer.Destroy;
     52destructor TProducerC.Destroy;
    5353begin
    5454  TextSource.Free;
     
    5656end;
    5757
    58 function TCProducer.TranslateType(Name: string): string;
     58function TProducerC.TranslateType(Name: string): string;
    5959begin
    6060  if Name = 'Byte' then Result := 'uint8'
     
    6767end;
    6868
    69 function TCProducer.TranslateOperator(Name: string): string;
     69function TProducerC.TranslateOperator(Name: string): string;
    7070begin
    7171  if Name = '=' then Result := '=='
     
    8282end;
    8383
    84 procedure TCProducer.Emit(Text: string);
     84procedure TProducerC.Emit(Text: string);
    8585begin
    8686  TextSource.Add(DupeString(' ', IndentationLength * Indetation) + Text);
    8787end;
    8888
    89 procedure TCProducer.GenerateUses(UsedModules: TUsedModuleList);
     89procedure TProducerC.GenerateUses(UsedModules: TUsedModuleList);
    9090var
    9191  I: Integer;
     
    9696end;
    9797
    98 procedure TCProducer.GenerateModule(Module: TModule);
     98procedure TProducerC.GenerateModule(Module: TModule);
    9999begin
    100100  Emit('#define int8 char');
     
    109109end;
    110110
    111 procedure TCProducer.Produce;
     111procedure TProducerC.Produce;
    112112begin
    113113  inherited;
     
    116116end;
    117117
    118 procedure TCProducer.GenerateProgram(ProgramBlock: TProgram);
     118procedure TProducerC.GenerateProgram(ProgramBlock: TProgram);
    119119var
    120120  I: Integer;
     
    126126end;
    127127
    128 procedure TCProducer.GenerateFunctions(Functions: TFunctionList);
     128procedure TProducerC.GenerateFunctions(Functions: TFunctionList);
    129129var
    130130  I: Integer;
     
    152152end;
    153153
    154 procedure TCProducer.GenerateBeginEnd(BeginEnd: TBeginEnd);
     154procedure TProducerC.GenerateBeginEnd(BeginEnd: TBeginEnd);
    155155var
    156156  I: Integer;
     
    176176end;
    177177
    178 procedure TCProducer.GenerateCommand(Command: TCommand);
     178procedure TProducerC.GenerateCommand(Command: TCommand);
    179179begin
    180180  if Command is TBeginEnd then GenerateBeginEnd(TBeginEnd(Command))
     
    185185end;
    186186
    187 procedure TCProducer.GenerateWhileDo(WhileDo: TWhileDo);
     187procedure TProducerC.GenerateWhileDo(WhileDo: TWhileDo);
    188188begin
    189189  Emit('while (' + GenerateExpression(WhileDo.Condition) + ')');
     
    191191end;
    192192
    193 procedure TCProducer.GenerateIfThenElse(IfThenElse: TIfThenElse);
     193procedure TProducerC.GenerateIfThenElse(IfThenElse: TIfThenElse);
    194194begin
    195195  Emit('if(' + GenerateExpression(IfThenElse.Condition) + ')');
     
    201201end;
    202202
    203 procedure TCProducer.GenerateAssignment(Assignment: TAssignment);
     203procedure TProducerC.GenerateAssignment(Assignment: TAssignment);
    204204begin
    205205  if Assignment.Target.Name = 'Result' then Emit('return(' + GenerateExpression(Assignment.Source) + ');')
     
    207207end;
    208208
    209 procedure TCProducer.GenerateFunctionCall(FunctionCall: TFunctionCall);
     209procedure TProducerC.GenerateFunctionCall(FunctionCall: TFunctionCall);
    210210var
    211211  Line: string;
     
    225225end;
    226226
    227 function TCProducer.GenerateExpression(Expression: TExpression): string;
     227function TProducerC.GenerateExpression(Expression: TExpression): string;
    228228begin
    229229  case Expression.NodeType of
     
    240240end;
    241241
    242 procedure TCProducer.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string);
     242procedure TProducerC.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string);
    243243var
    244244  I: Integer;
  • branches/DelphiToC/Produce/UProducerPascal.pas

    r51 r52  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, USourceCode, UCodeProducer, StrUtils;
     9  Dialogs, USourceCode, UProducer, StrUtils;
    1010
    1111type
     
    1313  { TProducerPascal }
    1414
    15   TProducerPascal = class(TCodeProducer)
     15  TProducerPascal = class(TProducer)
    1616  private
    1717    procedure Emit(Text: string; NewLine: Boolean = True);
  • branches/DelphiToC/UCompiler.pas

    r51 r52  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, USourceCode, UCodeProducer, UParser,
     9  Dialogs, USourceCode, UProducer, UParser,
    1010  UProducerC, Contnrs;
    1111
     
    2828    SourceCode: TStringList;
    2929    Parser: TPascalParser;
    30     Producer: TCodeProducer;
     30    Producer: TProducer;
    3131    ErrorMessages: TObjectList;
    3232    constructor Create;
     
    5353  SourceCode := TStringList.Create;
    5454  ProgramCode := TProgram.Create;
    55   Producer := TCProducer.Create;
     55  Producer := TProducerC.Create;
    5656  Producer.ProgramCode := ProgramCode;
    5757  Parser := TPascalParser.Create;
Note: See TracChangeset for help on using the changeset viewer.