Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Convertidores Lenguajes de programacion (https://www.clubdelphi.com/foros/showthread.php?t=51191)

JXJ 07-12-2007 21:04:40

Convertidores Lenguajes de programacion
 
Ultimamente he necesitado de hacer conversiones de
lenguajes de programación.

Saben de herramientas software, que conviertan
de un lenguaje de programacion a otro.

dijamos

java a delphi

c, c++ a delphi

csharp a delphi

delphi dotnet a csharp

delphi a c, c++

delphi a python

python a delphi.

y php a c, c++

o de php a delphi

jhonny 07-12-2007 22:07:24

Hace poco contruí un programa que hace uso del WSDL de CodeGear para pasar de CSharp a Delphi, anque no funciona a la perfección en todos los casos quizá te colaborara en algo...

http://www.clubdelphi.com/foros/showthread.php?t=47462

jhonny 07-12-2007 22:14:25

Acabo de probar el siguiente codigo que encontre en http://www.elguille.info/NET/cursoCS.../Entrega12.htm y verifique que sigue funcionando dicho servicio:

Código:

using System;

using System.Collections;

 

namespace IndizadorLibros

{

    class Libro

    {

        private ArrayList capitulos=new ArrayList();

 

        public object this[int indice]

        {

            get

            {

                if (indice >= capitulos.Count || indice < 0)

                    return null;

                else

                    return capitulos[indice];

            }

            set

            {

                if (indice >= 0 && indice < capitulos.Count)

                    capitulos[indice]=value;

                else if (indice == capitulos.Count)

                    capitulos.Add(value);

                else

                    throw new Exception("No se puede asignar a este elemento");

            }

        }   

   

        public int NumCapitulos

        {

            get

            {

                return capitulos.Count;

            }

        }

    }

 

    class IndizadorLibrosApp

    {

        static void Main()

        {

            Libro miLibro=new Libro();

 

            miLibro[0]="La psicología de la musaraña";

            miLibro[1]="¿Puede una hormiga montar en bicicleta?";

            miLibro[1]="Un pedrusco en manos de Miró es un Miró";

 

            for (int i=0;i<miLibro.NumCapitulos;i++)

                Console.WriteLine("Capitulo {0}: {1}",i+1,miLibro[i]);

 

            string a=Console.ReadLine();

        }

    }

}


Me lo ha convertido en esto:

Código Delphi [-]
//------------------------------------------------------------------------------
// 
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2407
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// 
//------------------------------------------------------------------------------

unit IndizadorLibros;

interface

type
  Libro = class
  strict private
    capitulos: ArrayList;
  public
    function get_this(indice: Integer): System.Object;
    function get_NumCapitulos: Integer;
    procedure set_this(indice: Integer; Value: System.Object);
    property this[indice: Integer]: System.Object read get_this write set_this;
    property NumCapitulos: Integer read get_NumCapitulos;
  end;
  
  
  IndizadorLibrosApp = class
  strict private
    class procedure Main;static; 
  end;
  
implementation

{$AUTOBOX ON}
{$HINTS OFF}
{$WARNINGS OFF}

function Libro.get_this(indice: Integer): System.Object;
begin
  if ((indice >= Self.capitulos.Count) or (indice < 0)) then
    begin
      Result := nil;
      Exit;
    end
  else
    begin
      Result := Self.capitulos[indice];
      Exit;
    end;
end;

function Libro.get_NumCapitulos: Integer;
begin
  Result := Self.capitulos.Count;
end;

procedure Libro.set_this(indice: Integer; Value: System.Object);
begin
  if ((indice >= 0) and (indice < Self.capitulos.Count)) then
    Self.capitulos[indice] := value
  else
    if (indice = Self.capitulos.Count) then
      Self.capitulos.Add(value)
    else
      raise Exception.Create('No se puede asignar a este elemento');
end;

class procedure IndizadorLibrosApp.Main;
var
  a: string;
  i: Integer;
  miLibro: Libro;
begin
  miLibro := Libro.Create;
  miLibro[0] := 'La psicolog?a de la musara?a';
  miLibro[1] := '?Puede una hormiga montar en bicicleta?';
  miLibro[1] := 'Un pedrusco en manos de Mir? es un Mir?';
  i := 0;
  while (i < miLibro.NumCapitulos) do
  begin
    Console.WriteLine('Capitulo {0}: {1}', (i + 1), miLibro[i]);
    /*PostInc*/;
  end;
  a := Console.ReadLine;
end;

end.

JXJ 08-12-2007 06:57:14

Gracias jhonny

que bonito es el codigo pascal

JXJ 08-12-2007 07:02:41

Gracias jhonny

que bonito es el codigo pascal


La franja horaria es GMT +2. Ahora son las 21:43:11.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi