Changeset 52
- Timestamp:
- Aug 10, 2010, 7:57:46 AM (14 years ago)
- Location:
- branches/DelphiToC
- Files:
-
- 3 added
- 3 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/DelphiToC.lpi
r51 r52 48 48 <TopLine Value="4"/> 49 49 <CursorPos X="1" Y="29"/> 50 <UsageCount Value="1 13"/>50 <UsageCount Value="146"/> 51 51 <Loaded Value="True"/> 52 52 </Unit0> … … 60 60 <EditorIndex Value="6"/> 61 61 <WindowIndex Value="0"/> 62 <TopLine Value=" 97"/>63 <CursorPos X=" 60" Y="112"/>64 <UsageCount Value="1 13"/>62 <TopLine Value="77"/> 63 <CursorPos X="35" Y="87"/> 64 <UsageCount Value="146"/> 65 65 <Loaded Value="True"/> 66 66 <LoadedDesigner Value="True"/> … … 73 73 <TopLine Value="1"/> 74 74 <CursorPos X="1" Y="1"/> 75 <UsageCount Value="1 13"/>75 <UsageCount Value="146"/> 76 76 </Unit2> 77 77 <Unit3> … … 83 83 <TopLine Value="637"/> 84 84 <CursorPos X="13" Y="668"/> 85 <UsageCount Value="1 13"/>85 <UsageCount Value="146"/> 86 86 <Loaded Value="True"/> 87 87 </Unit3> … … 94 94 <TopLine Value="1"/> 95 95 <CursorPos X="40" Y="16"/> 96 <UsageCount Value="1 13"/>96 <UsageCount Value="146"/> 97 97 <Loaded Value="True"/> 98 98 </Unit4> 99 99 <Unit5> 100 <Filename Value="Produce\U AssemblerSource.pas"/>101 <IsPartOfProject Value="True"/> 102 <UnitName Value="U AssemblerSource"/>100 <Filename Value="Produce\UProducerAsm8051.pas"/> 101 <IsPartOfProject Value="True"/> 102 <UnitName Value="UProducerAsm8051"/> 103 103 <EditorIndex Value="9"/> 104 104 <WindowIndex Value="0"/> 105 <TopLine Value="1 12"/>106 <CursorPos X=" 48" Y="128"/>107 <UsageCount Value="1 13"/>105 <TopLine Value="15"/> 106 <CursorPos X="19" Y="28"/> 107 <UsageCount Value="146"/> 108 108 <Loaded Value="True"/> 109 109 </Unit5> 110 110 <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"/> 114 115 <EditorIndex Value="1"/> 115 116 <WindowIndex Value="0"/> 116 117 <TopLine Value="1"/> 117 <CursorPos X=" 15" Y="13"/>118 <UsageCount Value="1 13"/>118 <CursorPos X="5" Y="13"/> 119 <UsageCount Value="146"/> 119 120 <Loaded Value="True"/> 120 121 </Unit6> … … 125 126 <EditorIndex Value="10"/> 126 127 <WindowIndex Value="0"/> 127 <TopLine Value=" 128"/>128 <CursorPos X=" 34" Y="141"/>129 <UsageCount Value="1 13"/>128 <TopLine Value="2"/> 129 <CursorPos X="13" Y="15"/> 130 <UsageCount Value="146"/> 130 131 <Loaded Value="True"/> 131 132 </Unit7> … … 138 139 <TopLine Value="1021"/> 139 140 <CursorPos X="1" Y="1026"/> 140 <UsageCount Value="1 13"/>141 <UsageCount Value="146"/> 141 142 <Loaded Value="True"/> 142 143 </Unit8> … … 147 148 <TopLine Value="78"/> 148 149 <CursorPos X="14" Y="91"/> 149 <UsageCount Value="5 5"/>150 <UsageCount Value="52"/> 150 151 </Unit9> 151 152 <Unit10> … … 155 156 <TopLine Value="1555"/> 156 157 <CursorPos X="1" Y="1"/> 157 <UsageCount Value=" 4"/>158 <UsageCount Value="1"/> 158 159 </Unit10> 159 160 <Unit11> … … 163 164 <TopLine Value="61"/> 164 165 <CursorPos X="7" Y="68"/> 165 <UsageCount Value=" 40"/>166 <UsageCount Value="56"/> 166 167 <Loaded Value="True"/> 167 168 </Unit11> … … 172 173 <TopLine Value="139"/> 173 174 <CursorPos X="16" Y="146"/> 174 <UsageCount Value=" 40"/>175 <UsageCount Value="56"/> 175 176 <Loaded Value="True"/> 176 177 </Unit12> … … 180 181 <TopLine Value="934"/> 181 182 <CursorPos X="10" Y="947"/> 182 <UsageCount Value=" 8"/>183 <UsageCount Value="5"/> 183 184 </Unit13> 184 185 <Unit14> … … 187 188 <TopLine Value="834"/> 188 189 <CursorPos X="11" Y="847"/> 189 <UsageCount Value=" 4"/>190 <UsageCount Value="1"/> 190 191 </Unit14> 191 192 <Unit15> … … 194 195 <TopLine Value="153"/> 195 196 <CursorPos X="8" Y="166"/> 196 <UsageCount Value="1 3"/>197 <UsageCount Value="10"/> 197 198 </Unit15> 198 199 <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"/> 203 203 <EditorIndex Value="2"/> 204 204 <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"/> 208 208 <Loaded Value="True"/> 209 209 </Unit16> … … 214 214 <TopLine Value="2656"/> 215 215 <CursorPos X="3" Y="2669"/> 216 <UsageCount Value=" 4"/>216 <UsageCount Value="1"/> 217 217 </Unit17> 218 218 <Unit18> … … 221 221 <TopLine Value="559"/> 222 222 <CursorPos X="57" Y="571"/> 223 <UsageCount Value="1 3"/>223 <UsageCount Value="10"/> 224 224 </Unit18> 225 225 <Unit19> … … 231 231 <TopLine Value="1"/> 232 232 <CursorPos X="23" Y="9"/> 233 <UsageCount Value=" 30"/>233 <UsageCount Value="62"/> 234 234 <Loaded Value="True"/> 235 235 </Unit19> … … 238 238 <Position1> 239 239 <Filename Value="Analyze\UParser.pas"/> 240 <Caret Line="100 6" Column="1" TopLine="992"/>240 <Caret Line="1001" Column="28" TopLine="988"/> 241 241 </Position1> 242 242 <Position2> 243 243 <Filename Value="Analyze\UParser.pas"/> 244 <Caret Line="10 04" Column="9" TopLine="991"/>244 <Caret Line="1024" Column="57" TopLine="1011"/> 245 245 </Position2> 246 246 <Position3> 247 247 <Filename Value="Analyze\UParser.pas"/> 248 <Caret Line="10 13" Column="16" TopLine="1002"/>248 <Caret Line="1022" Column="45" TopLine="1009"/> 249 249 </Position3> 250 250 <Position4> 251 251 <Filename Value="Analyze\UParser.pas"/> 252 <Caret Line="10 21" Column="14" TopLine="1008"/>252 <Caret Line="1030" Column="39" TopLine="1017"/> 253 253 </Position4> 254 254 <Position5> 255 255 <Filename Value="Analyze\UParser.pas"/> 256 <Caret Line="10 24" Column="35" TopLine="1010"/>256 <Caret Line="1031" Column="41" TopLine="1018"/> 257 257 </Position5> 258 258 <Position6> 259 259 <Filename Value="Analyze\UParser.pas"/> 260 <Caret Line="10 29" Column="21" TopLine="1016"/>260 <Caret Line="1067" Column="63" TopLine="1051"/> 261 261 </Position6> 262 262 <Position7> 263 263 <Filename Value="Analyze\UParser.pas"/> 264 <Caret Line="10 11" Column="33" TopLine="1010"/>264 <Caret Line="1058" Column="54" TopLine="1045"/> 265 265 </Position7> 266 266 <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"/> 269 269 </Position8> 270 270 <Position9> 271 <Filename Value=" Analyze\UParser.pas"/>272 <Caret Line="1 001" Column="28" TopLine="988"/>271 <Filename Value="Forms\UMainForm.pas"/> 272 <Caret Line="111" Column="60" TopLine="96"/> 273 273 </Position9> 274 274 <Position10> 275 <Filename Value=" Analyze\UParser.pas"/>276 <Caret Line="1 024" Column="57" TopLine="1011"/>275 <Filename Value="Produce\UProducer.pas"/> 276 <Caret Line="11" Column="11" TopLine="1"/> 277 277 </Position10> 278 278 <Position11> 279 <Filename Value=" Analyze\UParser.pas"/>280 <Caret Line="1 022" Column="45" TopLine="1009"/>279 <Filename Value="Forms\UMainForm.pas"/> 280 <Caret Line="111" Column="60" TopLine="96"/> 281 281 </Position11> 282 282 <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"/> 285 285 </Position12> 286 286 <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"/> 289 289 </Position13> 290 290 <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"/> 293 293 </Position14> 294 294 <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"/> 297 297 </Position15> 298 298 <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"/> 301 301 </Position16> 302 302 <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"/> 305 305 </Position17> 306 306 <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"/> 309 309 </Position18> 310 310 <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"/> 313 313 </Position19> 314 314 <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"/> 317 317 </Position20> 318 318 <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"/> 321 321 </Position21> 322 322 <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"/> 325 325 </Position22> 326 326 <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"/> 329 329 </Position23> 330 330 <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"/> 333 333 </Position24> 334 334 <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"/> 337 337 </Position25> 338 338 <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"/> 341 341 </Position26> 342 342 <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"/> 345 345 </Position27> 346 346 <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"/> 349 349 </Position28> 350 350 <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"/> 353 353 </Position29> 354 354 <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"/> 357 357 </Position30> 358 358 </JumpHistory> -
branches/DelphiToC/DelphiToC.lpr
r51 r52 12 12 USourceCode, 13 13 UCompiler, 14 U AssemblerSource in 'Produce\UAssemblerSource.pas',15 U CodeProducer in 'Produce\UCodeProducer.pas',14 UProducerAsm8051, 15 UProducer, 16 16 UProducerC, UProducerPascal, 17 UParser, U SourceTree;17 UParser, UProducerTreeView; 18 18 19 19 {$R *.res} -
branches/DelphiToC/Forms/UMainForm.lfm
r51 r52 1 1 object MainForm: TMainForm 2 Left = 2732 Left = 176 3 3 Height = 498 4 Top = 1054 Top = 77 5 5 Width = 881 6 6 Caption = 'Pascal Compiler AVR' … … 25 25 TabOrder = 0 26 26 end 27 object Memo2: TMemo28 Left = 67229 Height = 36330 Top = 3231 Width = 20332 Anchors = [akTop, akLeft, akRight, akBottom]33 Font.Height = -1334 Font.Name = 'Lucida Console'35 ParentFont = False36 ScrollBars = ssBoth37 TabOrder = 138 end39 object TreeView1: TTreeView40 Left = 36841 Height = 38742 Top = 843 Width = 29644 Anchors = [akTop, akLeft, akBottom]45 DefaultItemHeight = 1546 Indent = 1947 TabOrder = 248 end49 27 inline SynEdit1: TSynEdit 50 28 Left = 8 51 29 Height = 388 52 30 Top = 8 53 Width = 35231 Width = 488 54 32 Anchors = [akTop, akLeft, akBottom] 55 33 Font.Height = -13 … … 59 37 ParentColor = False 60 38 ParentFont = False 61 TabOrder = 339 TabOrder = 1 62 40 Gutter.Width = 57 63 41 Gutter.MouseActions = < … … 742 720 end 743 721 object ComboBox1: TComboBox 744 Left = 672722 Left = 504 745 723 Height = 21 746 724 Top = 8 747 Width = 205725 Width = 373 748 726 Anchors = [akTop, akLeft, akRight] 749 727 ItemHeight = 13 … … 753 731 'C' 754 732 'i8051' 733 'TreeView' 755 734 ) 756 735 OnChange = ComboBox1Change 757 736 Style = csDropDownList 758 TabOrder = 4737 TabOrder = 2 759 738 Text = 'Pascal' 760 739 end … … 767 746 ItemHeight = 0 768 747 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 770 758 end 771 759 object SynPasSyn1: TSynPasSyn -
branches/DelphiToC/Forms/UMainForm.pas
r51 r52 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, StdCtrls, USourceCode, UCompiler, U AssemblerSource,10 UProducerC, ComCtrls, SynEdit, SynHighlighterPas, USourceTree,9 Dialogs, StdCtrls, USourceCode, UCompiler, UProducerAsm8051, 10 UProducerC, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, UProducerTreeView, 11 11 UProducerPascal, Contnrs; 12 12 … … 21 21 ComboBox1: TComboBox; 22 22 ListBox1: TListBox; 23 Memo2: TMemo;23 Panel1: TPanel; 24 24 SynEdit1: TSynEdit; 25 25 SynPasSyn1: TSynPasSyn; 26 TreeView1: TTreeView;27 26 procedure ComboBox1Change(Sender: TObject); 28 27 procedure FormShow(Sender: TObject); … … 35 34 private 36 35 public 36 ProducerControl: TControl; 37 37 Compiler: TCompiler; 38 SourceTree: T SourceTree;38 SourceTree: TProducerTreeView; 39 39 end; 40 40 … … 55 55 Compiler.SourceCode.Assign(SynEdit1.Lines); 56 56 57 Memo2.Clear;57 ProducerControl.Free; 58 58 if ComboBox1.ItemIndex = 0 then begin 59 59 Compiler.Producer.Free; … … 61 61 Compiler.Producer.ProgramCode := Compiler.ProgramCode; 62 62 Compiler.Compile; 63 ProducerControl := TMemo.Create(Self); 64 ProducerControl.Parent := Panel1; 65 ProducerControl.Align := alClient; 63 66 with TProducerPascal(Compiler.Producer) do 64 Memo2.Lines.Assign(TextSource);67 TMemo(ProducerControl).Lines.Assign(TextSource); 65 68 end else 66 69 if ComboBox1.ItemIndex = 1 then begin 67 70 Compiler.Producer.Free; 68 Compiler.Producer := T CProducer.Create;71 Compiler.Producer := TProducerC.Create; 69 72 Compiler.Producer.ProgramCode := Compiler.ProgramCode; 70 73 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); 73 79 end else 74 80 if ComboBox1.ItemIndex = 2 then begin 75 81 Compiler.Producer.Free; 76 Compiler.Producer := T AssemblerProducer.Create;82 Compiler.Producer := TProducerAsm8051.Create; 77 83 Compiler.Producer.ProgramCode := Compiler.ProgramCode; 78 84 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 80 89 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; 82 101 end; 83 102 LoadErrorMessages; 84 85 SourceTree.TreeView := TreeView1;86 SourceTree.Code := Compiler.ProgramCode;87 SourceTree.Fill;88 103 end; 89 104 … … 115 130 begin 116 131 Compiler := TCompiler.Create; 117 SourceTree := T SourceTree.Create;132 SourceTree := TProducerTreeView.Create; 118 133 end; 119 134 -
branches/DelphiToC/Produce/UProducerC.pas
r51 r52 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, StdCtrls, USourceCode, U CodeProducer, StrUtils;9 Dialogs, StdCtrls, USourceCode, UProducer, StrUtils; 10 10 11 11 type 12 12 13 { T CProducer}14 15 T CProducer = class(TCodeProducer)13 { TProducerC } 14 15 TProducerC = class(TProducer) 16 16 private 17 17 function TranslateType(Name: string): string; … … 42 42 implementation 43 43 44 { T CProducer}45 46 constructor T CProducer.Create;44 { TProducerC } 45 46 constructor TProducerC.Create; 47 47 begin 48 48 TextSource := TStringList.Create; … … 50 50 end; 51 51 52 destructor T CProducer.Destroy;52 destructor TProducerC.Destroy; 53 53 begin 54 54 TextSource.Free; … … 56 56 end; 57 57 58 function T CProducer.TranslateType(Name: string): string;58 function TProducerC.TranslateType(Name: string): string; 59 59 begin 60 60 if Name = 'Byte' then Result := 'uint8' … … 67 67 end; 68 68 69 function T CProducer.TranslateOperator(Name: string): string;69 function TProducerC.TranslateOperator(Name: string): string; 70 70 begin 71 71 if Name = '=' then Result := '==' … … 82 82 end; 83 83 84 procedure T CProducer.Emit(Text: string);84 procedure TProducerC.Emit(Text: string); 85 85 begin 86 86 TextSource.Add(DupeString(' ', IndentationLength * Indetation) + Text); 87 87 end; 88 88 89 procedure T CProducer.GenerateUses(UsedModules: TUsedModuleList);89 procedure TProducerC.GenerateUses(UsedModules: TUsedModuleList); 90 90 var 91 91 I: Integer; … … 96 96 end; 97 97 98 procedure T CProducer.GenerateModule(Module: TModule);98 procedure TProducerC.GenerateModule(Module: TModule); 99 99 begin 100 100 Emit('#define int8 char'); … … 109 109 end; 110 110 111 procedure T CProducer.Produce;111 procedure TProducerC.Produce; 112 112 begin 113 113 inherited; … … 116 116 end; 117 117 118 procedure T CProducer.GenerateProgram(ProgramBlock: TProgram);118 procedure TProducerC.GenerateProgram(ProgramBlock: TProgram); 119 119 var 120 120 I: Integer; … … 126 126 end; 127 127 128 procedure T CProducer.GenerateFunctions(Functions: TFunctionList);128 procedure TProducerC.GenerateFunctions(Functions: TFunctionList); 129 129 var 130 130 I: Integer; … … 152 152 end; 153 153 154 procedure T CProducer.GenerateBeginEnd(BeginEnd: TBeginEnd);154 procedure TProducerC.GenerateBeginEnd(BeginEnd: TBeginEnd); 155 155 var 156 156 I: Integer; … … 176 176 end; 177 177 178 procedure T CProducer.GenerateCommand(Command: TCommand);178 procedure TProducerC.GenerateCommand(Command: TCommand); 179 179 begin 180 180 if Command is TBeginEnd then GenerateBeginEnd(TBeginEnd(Command)) … … 185 185 end; 186 186 187 procedure T CProducer.GenerateWhileDo(WhileDo: TWhileDo);187 procedure TProducerC.GenerateWhileDo(WhileDo: TWhileDo); 188 188 begin 189 189 Emit('while (' + GenerateExpression(WhileDo.Condition) + ')'); … … 191 191 end; 192 192 193 procedure T CProducer.GenerateIfThenElse(IfThenElse: TIfThenElse);193 procedure TProducerC.GenerateIfThenElse(IfThenElse: TIfThenElse); 194 194 begin 195 195 Emit('if(' + GenerateExpression(IfThenElse.Condition) + ')'); … … 201 201 end; 202 202 203 procedure T CProducer.GenerateAssignment(Assignment: TAssignment);203 procedure TProducerC.GenerateAssignment(Assignment: TAssignment); 204 204 begin 205 205 if Assignment.Target.Name = 'Result' then Emit('return(' + GenerateExpression(Assignment.Source) + ');') … … 207 207 end; 208 208 209 procedure T CProducer.GenerateFunctionCall(FunctionCall: TFunctionCall);209 procedure TProducerC.GenerateFunctionCall(FunctionCall: TFunctionCall); 210 210 var 211 211 Line: string; … … 225 225 end; 226 226 227 function T CProducer.GenerateExpression(Expression: TExpression): string;227 function TProducerC.GenerateExpression(Expression: TExpression): string; 228 228 begin 229 229 case Expression.NodeType of … … 240 240 end; 241 241 242 procedure T CProducer.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string);242 procedure TProducerC.GenerateCommonBlock(CommonBlock: TCommonBlock; LabelPrefix: string); 243 243 var 244 244 I: Integer; -
branches/DelphiToC/Produce/UProducerPascal.pas
r51 r52 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, USourceCode, U CodeProducer, StrUtils;9 Dialogs, USourceCode, UProducer, StrUtils; 10 10 11 11 type … … 13 13 { TProducerPascal } 14 14 15 TProducerPascal = class(T CodeProducer)15 TProducerPascal = class(TProducer) 16 16 private 17 17 procedure Emit(Text: string; NewLine: Boolean = True); -
branches/DelphiToC/UCompiler.pas
r51 r52 7 7 uses 8 8 SysUtils, Variants, Classes, Graphics, Controls, Forms, 9 Dialogs, USourceCode, U CodeProducer, UParser,9 Dialogs, USourceCode, UProducer, UParser, 10 10 UProducerC, Contnrs; 11 11 … … 28 28 SourceCode: TStringList; 29 29 Parser: TPascalParser; 30 Producer: T CodeProducer;30 Producer: TProducer; 31 31 ErrorMessages: TObjectList; 32 32 constructor Create; … … 53 53 SourceCode := TStringList.Create; 54 54 ProgramCode := TProgram.Create; 55 Producer := T CProducer.Create;55 Producer := TProducerC.Create; 56 56 Producer.ProgramCode := ProgramCode; 57 57 Parser := TPascalParser.Create;
Note:
See TracChangeset
for help on using the changeset viewer.