Changeset 180 for trunk/Target


Ignore:
Timestamp:
Aug 26, 2024, 9:15:43 PM (3 months ago)
Author:
chronos
Message:
  • Added: Ruby target.
Location:
trunk/Target
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/TargetC.pas

    r161 r180  
    6868
    6969  AddLine('#include <stdio.h>');
    70   AddLine('');
     70  AddLine;
    7171  AddLine('int main()');
    7272  AddLine('{');
     
    7575  AddLine('int Pos;');
    7676  AddLine('char ReadChar;');
    77   AddLine('');
     77  AddLine;
    7878  AddLine('Pos = 0;');
    7979  FProgramIndex := 0;
  • trunk/Target/TargetDelphi.pas

    r161 r180  
    5454
    5555  AddLine('program ' + ProgramName + ';');
    56   AddLine('');
     56  AddLine;
    5757  AddLine('{$APPTYPE CONSOLE}');
    58   AddLine('');
     58  AddLine;
    5959  AddLine('var');
    6060  AddLine('  Memory: array[0..' + IntToStr(MemorySize) + '] of Byte;');
  • trunk/Target/TargetJavascript.pas

    r161 r180  
    5656  AddLine('var Memory = new Array(' + IntToStr(MemorySize) + ').fill(0);');
    5757  AddLine('var Pos = 0;');
    58   AddLine('');
     58  AddLine;
    5959  FProgramIndex := 0;
    6060  while FProgramIndex < FProgram.Count do begin
  • trunk/Target/TargetPHP.pas

    r161 r180  
    5959
    6060  AddLine('<?php // ' + ProgramName);
    61   AddLine('');
     61  AddLine;
    6262  AddLine('$Memory = str_repeat("\0", ' + IntToStr(MemorySize) + ');');
    6363  AddLine('$Position = 0;');
     
    7676      cmMultiply: AddLine(GetMemoryCell + ' = chr(ord(' + GetMemoryCell + ') + ord($Memory[$Position]) * ' + IntToStr(FProgram[FProgramIndex].Parameter) + ');');
    7777      cmLoopStart: begin
    78         AddLine('while(' + GetMemoryCell + ' != "\0") {');
     78        AddLine('while(' + GetMemoryCell + ' != "\0")');
     79        AddLine('{');
    7980        Inc(Indent);
    8081      end;
  • trunk/Target/TargetPython.pas

    r161 r180  
    5959
    6060  AddLine('# ' + ProgramName);
    61   AddLine('');
     61  AddLine;
    6262  AddLine('class _Getch:');
    6363  AddLine('    """Gets a single character from standard input.  Does not echo to the screen."""');
     
    6767  AddLine('        except ImportError:');
    6868  AddLine('            self.impl = _GetchUnix()');
    69   AddLine('');
     69  AddLine;
    7070  AddLine('    def __call__(self): return self.impl()');
    71   AddLine('');
    72   AddLine('');
     71  AddLine;
     72  AddLine;
    7373  AddLine('class _GetchUnix:');
    7474  AddLine('    def __init__(self):');
    7575  AddLine('        import tty, sys');
    76   AddLine('');
     76  AddLine;
    7777  AddLine('    def __call__(self):');
    7878  AddLine('        import sys, tty, termios');
     
    8585  AddLine('            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)');
    8686  AddLine('        return ch');
    87   AddLine('');
    88   AddLine('');
     87  AddLine;
     88  AddLine;
    8989  AddLine('class _GetchWindows:');
    9090  AddLine('    def __init__(self):');
    9191  AddLine('        import msvcrt');
    92   AddLine('');
     92  AddLine;
    9393  AddLine('    def __call__(self):');
    9494  AddLine('        import msvcrt');
    9595  AddLine('        return msvcrt.getch()');
    96   AddLine('');
     96  AddLine;
    9797  AddLine('getchar = _Getch()');
    98   AddLine('');
     98  AddLine;
    9999  AddLine('import sys');
    100100  AddLine('memory = [0] * ' + IntToStr(MemorySize));
  • trunk/Target/TargetRust.pas

    r161 r180  
    7575  AddLine('let mut memory: [u8; ' + IntToStr(MemorySize) + '] = [0; ' + IntToStr(MemorySize) + '];');
    7676  AddLine('let mut pos = 0;');
    77   AddLine('');
     77  AddLine;
    7878  FProgramIndex := 0;
    7979  while FProgramIndex < FProgram.Count do begin
Note: See TracChangeset for help on using the changeset viewer.