Changeset 64 for trunk/Target/UTargetJava.pas
- Timestamp:
- Dec 4, 2014, 2:59:28 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Target/UTargetJava.pas
r60 r64 66 66 FProgramIndex := 0; 67 67 while (FProgramIndex < Length(FProgram)) do begin 68 case FProgram[FProgramIndex] of 69 cmPointerInc: begin 70 Sum := CheckOccurence(cmPointerInc); 71 AddLine('Pos = Pos + ' + IntToStr(Sum) + ';'); 72 end; 73 cmPointerDec: begin 74 Sum := CheckOccurence(cmPointerDec); 75 AddLine('Pos = Pos - ' + IntToStr(Sum) + ';'); 76 end; 77 cmInc: begin 78 Sum := CheckOccurence(cmInc); 79 AddLine('Memory[Pos] = (char)((int)Memory[Pos] + ' + IntToStr(Sum) + ');'); 80 end; 81 cmDec: begin 82 Sum := CheckOccurence(cmDec); 83 AddLine('Memory[Pos] = (char)((int)Memory[Pos] - ' + IntToStr(Sum) + ');'); 84 end; 68 case FProgram[FProgramIndex].Command of 69 cmPointerInc: AddLine('Pos = Pos + ' + IntToStr(FProgram[FProgramIndex].Parameter) + ';'); 70 cmPointerDec: AddLine('Pos = Pos - ' + IntToStr(FProgram[FProgramIndex].Parameter) + ';'); 71 cmInc: AddLine('Memory[Pos] = (char)((int)Memory[Pos] + ' + IntToStr(FProgram[FProgramIndex].Parameter) + ');'); 72 cmDec: AddLine('Memory[Pos] = (char)((int)Memory[Pos] - ' + IntToStr(FProgram[FProgramIndex].Parameter) + ');'); 85 73 cmOutput: AddLine('System.out.print(Memory[Pos]);'); 86 74 cmInput: AddLine('Memory[Pos] = (char)System.in.read();'); 75 cmSet: AddLine('Memory[Pos] = ' + IntToStr(FProgram[FProgramIndex].Parameter) + ';'); 87 76 cmLoopStart: begin 88 if CheckClear then begin 89 AddLine('Memory[Pos] = 0;'); 90 Inc(FProgramIndex, 2); 91 end else begin 92 AddLine('while(Memory[Pos] != 0)'); 93 AddLine('{'); 94 Inc(Indent); 95 end; 77 AddLine('while(Memory[Pos] != 0)'); 78 AddLine('{'); 79 Inc(Indent); 96 80 end; 97 81 cmLoopEnd: begin
Note:
See TracChangeset
for help on using the changeset viewer.