Recent

Author Topic: Converting Delphi Program  (Read 7651 times)

Mfbrowne

  • New member
  • *
  • Posts: 7
Converting Delphi Program
« on: September 30, 2016, 05:51:16 pm »
Hello,

I am new to Lazarus and I hope this would be the correct place for help on this problem I have.

 I am trying to convert a Delphi program to Lazarus. I tried using the Delphi Conversion under tools but I am not having much luck in getting a converted result.

I am getting the following messages:

Messages, Hints: 5
Hint: * Converting file C:\Delphi\RESTDemo\RESTDemo\RESTDemos.dpr *
Hint: Added defines -dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL in custom options
Hint: Error="Problems when trying to find all units from project file C:\Delphi\RESTDemo\RESTDemo\RESTDemos.dpr"
Hint: Conversion Aborted.
Hint: This log was saved to C:\Delphi\RESTDemo\RESTDemo\AutomaticConversion.log
Codetools, Errors: 1
RESTDemos.dpr(12,5) Error: expected ;, but end of file found

And if I try to build the project after I am getting this error, but don't know how or what to do to correct the situation.

So any assistance would be certainly appreciated.

Thanks

Mike

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Converting Delphi Program
« Reply #1 on: September 30, 2016, 06:16:13 pm »
Welcome to this forum  :D

Quote
RESTDemos.dpr(12,5) Error: expected ;, but end of file found

The message said it need a ; (semicolon symbol). Have you tried to open the file and add the semicolon symbol on the location it mentioned? If you didn't, try it ... it may work.

Also, make sure all the unit files are in the folder too. You need the source code of the units not the compiled unit files.
« Last Edit: September 30, 2016, 06:24:13 pm by Handoko »

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Converting Delphi Program
« Reply #2 on: September 30, 2016, 06:21:07 pm »
If Handoko's suggestion does not help, then you may need to zip the Delphi sources (i.e. .dpr & .pas only) and attach here for more specific help.

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: Converting Delphi Program
« Reply #3 on: September 30, 2016, 08:13:18 pm »
Hint: Error="Problems when trying to find all units from project file C:\Delphi\RESTDemo\RESTDemo\RESTDemos.dpr"
Hint: Conversion Aborted.
Hint: This log was saved to C:\Delphi\RESTDemo\RESTDemo\AutomaticConversion.log
Hm .. post the AutomaticConversion.log ?

=> "Problems when trying to find all units from project file"

RESTDemos.dpr(12,5) Error: expected ;, but end of file found
This means nothing. Previous errors may let the compiler run into the wrong direction ..

REST Client Library ?
« Last Edit: September 30, 2016, 08:22:30 pm by PeterX »
usually using latest Lazarus release version with Windows 10

Mfbrowne

  • New member
  • *
  • Posts: 7
Re: Converting Delphi Program
« Reply #4 on: September 30, 2016, 09:23:33 pm »
Thank you for the advice, which I tried and did not get a solution. I have attached the small app source as a zip file and would appreciate any additional assistance. The log file does not say much except aborted.

Thanks

Appreciate the help

Mike

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: Converting Delphi Program
« Reply #5 on: September 30, 2016, 09:52:30 pm »
Code: Pascal  [Select][+][-]
  1. uses
  2.   Vcl.Forms,
  3.  
First, Lazarus uses LCL, not VCL
http://wiki.freepascal.org/Lazarus_For_Delphi_Users#VCL_-.3E_LCL

Second, the conversion fails at the dot inbetween "Vcl.Forms".  (line 12, pos 5)
usually using latest Lazarus release version with Windows 10

Mfbrowne

  • New member
  • *
  • Posts: 7
Re: Converting Delphi Program
« Reply #6 on: September 30, 2016, 10:12:08 pm »
Still no luck. Because I am so new it is hard to identify exactly what is missing and how it should be formed.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Converting Delphi Program
« Reply #7 on: September 30, 2016, 10:32:25 pm »
This Delphi example of Windows-specific code cannot be simply converted directly into Lazarus/LCL code.

Apart from the converter itself choking on dotted file names, the demo depends on extended RTTI which is not yet implemented by the FP compiler. Also there is no directly Delphi-compatible REST library for FPC that I know of. FPC takes a different approach, offering packages such as fpweb (among others).
The functionality can be reproduced in FPC/Lazarus, but I suspect would have to be pretty much re-written from scratch using packages and libraries that have been written without the constraint of needing to be compatible with the APIs in Delphi's offerings.

Also the files you attached clearly state that they are copyright by Embarcadero, and are software that may only be used by licensees of Embarcadero products. So you are probably breaking the terms of your licence with Embarcadero by publishing them here.
« Last Edit: September 30, 2016, 10:44:34 pm by howardpc »

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Converting Delphi Program
« Reply #8 on: September 30, 2016, 10:37:43 pm »
Code: Pascal  [Select][+][-]
  1. uses
  2.   Vcl.Forms,
  3.  
... the conversion fails at the dot inbetween "Vcl.Forms".  (line 12, pos 5)

Please open a bugreport about this part of the issue.

Bart

PeterX

  • Sr. Member
  • ****
  • Posts: 404
Re: Converting Delphi Program
« Reply #9 on: September 30, 2016, 10:54:08 pm »
Please open a bugreport about this part of the issue.

Bart
Bart, please be patient.

When I started coding, on the C64,
then changed to D5 and SpeedPascal,
I also did not know where to look at first.

Give him some time to learn.
« Last Edit: September 30, 2016, 11:04:16 pm by PeterX »
usually using latest Lazarus release version with Windows 10

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Converting Delphi Program
« Reply #10 on: September 30, 2016, 11:07:31 pm »
Please open a bugreport about this part of the issue.

Bart
Bart, please be patient.
...
Give him some time to learn.

I don't understand your reply.
Obviously there is a bug in the converter tool.
This needs to be reported on the bugtracker, otherwise it will be forgotten.

Bart

Mfbrowne

  • New member
  • *
  • Posts: 7
Re: Converting Delphi Program
« Reply #11 on: October 03, 2016, 03:01:02 pm »
Hello,

Well thank you for the replies, I appreciate the information and the comments. The sample I picked was just a small piece of sample code that comes with my c++ Builder installation. I am new to the pascal language so I thought it would be a good example to see how it could be coded in Lazarus and Free Pascal.

So does anyone know of a JSON example that I could look at and play around with to get familiar with both the environment and coding of a pascal app.

Thanks

Mike

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Converting Delphi Program
« Reply #12 on: October 03, 2016, 03:24:46 pm »
The wiki page about fcl-json should get you started:
http://wiki.freepascal.org/fcl-json

Mfbrowne

  • New member
  • *
  • Posts: 7
Re: Converting Delphi Program
« Reply #13 on: October 03, 2016, 05:16:39 pm »
Thank you, I will have a look and hopefully get some understanding of it.

 

TinyPortal © 2005-2018