Re: Pascal to C source code translator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/21/11 16:34, Matthew Saltzman wrote:
> On Sat, 2011-05-21 at 12:20 -0700, JD wrote:
>> Been searching for a Pascal to C Source Code Translator
>> for Fedora to no avail.
>> I found an ancient tar file (ca 1996 ~ 1998), but it has way
>> too many errors to compile.
>>
>> Would appreciate a link to a working translator.
> Google "p2c pascal to c translator".  It doesn't appear to be packaged
> for Fedora, but there it is.
>
>> Thanx,
>>
>> JD
>>
As I indicated to another responder, I did download it from an
old fedora 7 package.
It has lots of bugs, and is unable to translate a very short and simple 
pascal module.
To wit, it outputs:

/* From input file "<stdin>" */


#include


/*$mode objfpc*/
/*$H+*/
/* <stdin>, line 5: Could not open output file for header */
/* Translation aborted. */
--------------------------

even though it is supposed to search /usr/include by default!

This is the sample pascal module:

unit PoTranslator;

{$mode objfpc}{$H+}

interface

uses
   Classes, SysUtils, LResources, typinfo, Translations;

type

  { TPoTranslator }

  TPoTranslator=class(TAbstractTranslator)
  private
   FPOFile:TPOFile;
  public
   constructor Create(POFileName:string);
   destructor Destroy;override;
   procedure TranslateStringProperty(Sender:TObject;
     const Instance: TPersistent; PropInfo: PPropInfo; var 
Content:string);override;
  end;

implementation

{ TPoTranslator }

constructor TPoTranslator.Create(POFileName: string);
begin
   inherited Create;
   FPOFile:=TPOFile.Create(POFileName);
end;

destructor TPoTranslator.Destroy;
begin
   FPOFile.Free;
   inherited Destroy;
end;

procedure TPoTranslator.TranslateStringProperty(Sender: TObject;
   const Instance: TPersistent; PropInfo: PPropInfo; var Content: string);
var
   s: String;
begin
   if not Assigned(FPOFile) then exit;
   if not Assigned(PropInfo) then exit;
{DO we really need this?}
   if Instance is TComponent then
    if csDesigning in (Instance as TComponent).ComponentState then exit;
{End DO :)}
   if (AnsiUpperCase(PropInfo^.PropType^.Name)<>'TTRANSLATESTRING') then 
exit;
   s:=FPOFile.Translate(Content, Content);
   if s<>'' then Content:=s;
end;

end.

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux