Changeset 37 for trunk/Compiler
- Timestamp:
- Feb 14, 2012, 7:33:51 AM (13 years ago)
- Location:
- trunk/Compiler/Produce
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Produce/UProducer.pas
r30 r37 17 17 TextSource: TStringList; 18 18 IndentationLength: Integer; 19 Indetation: Integer; 19 Indentation: Integer; 20 CompilerPath: string; 20 21 procedure Emit(AText: string); 21 22 procedure EmitLn(AText: string = ''); … … 56 57 if Count = 0 then Add(''); 57 58 if Strings[Count - 1] = '' then 58 Strings[Count - 1] := Strings[Count - 1] + DupeString(' ', IndentationLength * Inde tation);59 Strings[Count - 1] := Strings[Count - 1] + DupeString(' ', IndentationLength * Indentation); 59 60 Strings[Count - 1] := Strings[Count - 1] + AText; 60 61 end; -
trunk/Compiler/Produce/UProducerAsm8051.pas
r12 r37 109 109 AssemblyCode := TObjectList.Create; 110 110 Name := 'ASM 8051'; 111 {$IFDEF Windows} 112 CompilerPath := 'c:\ASM8051\ASM51.EXE'; 113 {$ENDIF} 111 114 end; 112 115 -
trunk/Compiler/Produce/UProducerDynamicC.pas
r17 r37 50 50 begin 51 51 Name := 'Dynamic C'; 52 {$IFDEF Windows} 53 CompilerPath := 'c:\Program Files\Dynamic C Rabbit 9.62\Dcrab_9.62.exe'; 54 {$ENDIF} 52 55 end; 53 56 … … 142 145 I: Integer; 143 146 begin 144 Inde tation := 0;147 Indentation := 0; 145 148 with ProgramBlock do 146 149 for I := 0 to Modules.Count - 1 do … … 180 183 begin 181 184 EmitLn('{'); 182 Inc(Inde tation);185 Inc(Indentation); 183 186 184 187 // Variables … … 191 194 GenerateCommand(TCommand(BeginEnd.Commands[I])); 192 195 193 Dec(Inde tation);196 Dec(Indentation); 194 197 EmitLn('}'); 195 198 end; … … 320 323 EmitLn('struct'); 321 324 EmitLn('{'); 322 Inc(Inde tation);325 Inc(Indentation); 323 326 GenerateVariableList(TTypeRecord(AType).CommonBlock.Variables); 324 Dec(Inde tation);327 Dec(Indentation); 325 328 EmitLn('} ' + TranslateType(AType.Name) + ';'); 326 329 EmitLn; … … 363 366 begin 364 367 if Types.Count > 0 then begin 365 Inc(Inde tation);368 Inc(Indentation); 366 369 for I := 0 to Types.Count - 1 do 367 370 with TType(Types[I]) do … … 371 374 EmitLn(';'); 372 375 end; 373 Dec(Inde tation);376 Dec(Indentation); 374 377 EmitLn(''); 375 378 end; -
trunk/Compiler/Produce/UProducerGCCC.pas
r12 r37 57 57 IndentationLength := 2; 58 58 Name := 'GCC C'; 59 {$IFDEF Windows} 60 CompilerPath := 'c:\Program Files\MinGW\bin\gcc.exe -o %1:s'; 61 {$ENDIF} 62 {$IFDEF Linux} 63 CompilerPath := '/usr/bin/gcc'; 64 {$ENDIF} 59 65 end; 60 66 -
trunk/Compiler/Produce/UProducerPascal.pas
r26 r37 56 56 inherited; 57 57 Name := 'Delphi'; 58 {$IFDEF Windows} 59 CompilerPath := 'c:\Program Files\Embarcadero\RAD Studio\9.0\bin\DCC32.EXE'; 60 {$ENDIF} 58 61 end; 59 62 … … 69 72 begin 70 73 EmitLn('uses'); 71 Inc(Inde tation);74 Inc(Indentation); 72 75 for I := 0 to UsedModules.Count - 1 do begin 73 76 if Assigned(TUsedModule(UsedModules[I]).Module) then … … 83 86 end; 84 87 EmitLn(';'); 85 Dec(Inde tation);88 Dec(Indentation); 86 89 EmitLn; 87 90 end; … … 134 137 if AType is TTypeRecord then begin 135 138 EmitLn('record'); 136 Inc(Inde tation);139 Inc(Indentation); 137 140 with TTypeRecord(AType).CommonBlock do 138 141 for I := 0 to Variables.Count - 1 do begin … … 141 144 EmitLn(';'); 142 145 end; 143 Dec(Inde tation);146 Dec(Indentation); 144 147 Emit('end'); 145 148 end else … … 174 177 if Types.Count > 0 then begin 175 178 EmitLn('type'); 176 Inc(Inde tation);179 Inc(Indentation); 177 180 for I := 0 to Types.Count - 1 do 178 181 with TType(Types[I]) do … … 182 185 EmitLn(';'); 183 186 end; 184 Dec(Inde tation);187 Dec(Indentation); 185 188 EmitLn; 186 189 end; … … 257 260 if Constants.Count > 0 then begin 258 261 EmitLn('const'); 259 Inc(Inde tation);262 Inc(Indentation); 260 263 for I := 0 to Constants.Count - 1 do 261 264 GenerateConstant(TConstant(Constants[I])); 262 Dec(Inde tation);265 Dec(Indentation); 263 266 Emit(''); 264 267 end; … … 279 282 begin 280 283 EmitLn('begin'); 281 Inc(Inde tation);284 Inc(Indentation); 282 285 // Commands 283 286 for I := 0 to BeginEnd.Commands.Count - 1 do begin … … 286 289 end; 287 290 288 Dec(Inde tation);291 Dec(Indentation); 289 292 Emit('end'); 290 293 end; … … 295 298 begin 296 299 EmitLn('var'); 297 Inc(Inde tation);300 Inc(Indentation); 298 301 for I := 0 to Variables.Count - 1 do 299 302 GenerateVariable(TVariable(Variables[I])); 300 Dec(Inde tation);303 Dec(Indentation); 301 304 EmitLn; 302 305 end; … … 404 407 Section: TCommonBlockSection; 405 408 begin 406 Inc(Inde tation);409 Inc(Indentation); 407 410 with CommonBlock do begin 408 411 for I := 0 to Order.Count - 1 do begin … … 410 413 if Section <> cbsType then begin 411 414 EmitLn; 412 Dec(Inde tation);415 Dec(Indentation); 413 416 EmitLn('type'); 414 Inc(Inde tation);417 Inc(Indentation); 415 418 end; 416 419 Emit(TType(Order[I]).Name + ' = '); … … 422 425 if Section <> cbsVariable then begin 423 426 EmitLn; 424 Dec(Inde tation);427 Dec(Indentation); 425 428 EmitLn('var'); 426 Inc(Inde tation);429 Inc(Indentation); 427 430 end; 428 431 GenerateVariable(TVariable(Order[I])); … … 432 435 if Section <> cbsConstant then begin 433 436 EmitLn; 434 Dec(Inde tation);437 Dec(Indentation); 435 438 EmitLn('const'); 436 Inc(Inde tation);439 Inc(Indentation); 437 440 end; 438 441 GenerateConstant(TConstant(Order[I])); … … 444 447 end; 445 448 end; 446 Dec(Inde tation);449 Dec(Indentation); 447 450 end; 448 451 … … 454 457 Section: TCommonBlockSection; 455 458 begin 456 Inc(Inde tation);459 Inc(Indentation); 457 460 with CommonBlock do begin 458 461 for I := 0 to Order.Count - 1 do begin … … 460 463 if Section <> cbsType then begin 461 464 EmitLn; 462 Dec(Inde tation);465 Dec(Indentation); 463 466 EmitLn('type'); 464 Inc(Inde tation);467 Inc(Indentation); 465 468 end; 466 469 Emit(TType(Order[I]).Name + ' = '); … … 472 475 if Section <> cbsVariable then begin 473 476 EmitLn; 474 Dec(Inde tation);477 Dec(Indentation); 475 478 EmitLn('var'); 476 Inc(Inde tation);479 Inc(Indentation); 477 480 end; 478 481 GenerateVariable(TVariable(Order[I])); … … 482 485 if Section <> cbsConstant then begin 483 486 EmitLn; 484 Dec(Inde tation);487 Dec(Indentation); 485 488 EmitLn('const'); 486 Inc(Inde tation);489 Inc(Indentation); 487 490 end; 488 491 GenerateConstant(TConstant(Order[I])); … … 495 498 GenerateBeginEnd(Code); 496 499 end; 497 Dec(Inde tation);500 Dec(Indentation); 498 501 end; 499 502
Note:
See TracChangeset
for help on using the changeset viewer.