Lazarus

Announcements => Third party => Topic started by: avra on June 27, 2015, 03:11:46 pm

Title: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on June 27, 2015, 03:11:46 pm
Introduction
I use both Lazarus and CodeTyphon, but I don't like the fact that projects and components can't simply be loaded to both. I really like many components that can be found only in CodeTyphon, but since it changed names of some basic packages I had to manually adjust them with each new release when I wanted to use them in Lazarus. I like to have a freedom to choose one or the other IDE, and ct2laz utility tries to solve this problem.

Info
ct2laz utility can convert CodeTyphon projects and component packages to Lazarus, and Lazarus projects and component packages to CodeTyphon. It can also download zillion component packages and project examples from CodeTyphon web site and execute needed source file transformations to make them compatible with Lazarus. You can use CodeTyphon local files instead of downloaded ones if you prefer that way. Such transformed component packages can be installed into Lazarus, and most of the provided CodeOcean examples should work out of the box. One of the advantages of using CodeTyphon pl_* packages is that many of them are trully cross platform and well tested on each supported platform. Package compatibility info for Win/Lin/BSD/Sol/Mac/GTK2/QT4/QT5/WinCE/x86/x86_64/Arm/Arm64 supported platforms can be found here. Some CodeTyphon packages will only work with trunk versions of FPC and Lazarus.

Download
Latest version with full sources can be downloaded from http://bitbucket.org/avra/ct2laz

Prerequisites
For archives extraction you will need to download 7zip tool from http://www.7-zip.org on Windows, or p7zip package on Linux.

License
ct2laz is released under Mozilla Public License 2.0 (MPL-2.0) https://www.mozilla.org/MPL/2.0
License is explained in plain English at https://www.tldrlegal.com/l/mpl-2.0

Community
Contributors are welcome. If you find bugs, create patches for this or some other feature, please report here or as an issue in repository.

UPDATE: Added Linux version info.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: Josh on June 27, 2015, 05:13:43 pm
Hi
Sounds like a really useful utility.
WHen I run the exe I get replacements.csv missing if i click ok, get index out of bounds
Ideas?

Edit. File is a separate download
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on June 27, 2015, 07:57:33 pm
WHen I run the exe I get replacements.csv missing if i click ok, get index out of bounds
You are right. Windows EXE was in downloads, while CSV was supposed to be downloaded from repository. Although you figured it out at the end, I have fixed it so CSV is also in downloads now. I hope it's less confusing now. Thanks!
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: rtusrghsdfhsfdhsdfhsfdhs on June 28, 2015, 09:21:04 am
Thank you very much for this.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on June 28, 2015, 09:59:21 am
Thank you very much for this.
You are welcome.  :D I am glad people find it useful. It was time for me to give something back to the community.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: verasan on July 01, 2015, 08:26:00 pm
Hello!!!
your tool sounds good but what about version for linux?
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on July 02, 2015, 08:58:17 am
what about version for linux?
When I catch time again I will try to integrate it with fpcup and then I will need to make it work on Linux too. There is nothing Windows specific in it so conversion shouldn't be too hard. If you take a look at the source you can find this:
Code: [Select]
  // linux: sh -c " whole commandline" (not tested yet)
  // OurProcess.Executable := '/bin/sh';
  // OurProcess.Parameters.Add('-c');
  // OurProcess.Parameters.Add('7z  -y x %COMPONENTS typhon/components/* -r -o%UNPACKDIR');
so I did think about linux. When time comes you will just need to install p7zip first with your package manager. I will probably default to 7zr instead and parameters will probably be different, but you get the picture. ct2laz should work with Wine, so I don't think that many folks will be eager for linux version and that's why it's not high on my priority list right now. If someone wants to take a bite on his own, be my guest and share a patch. ;)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 04, 2017, 01:41:39 am
I am asking for help to make this tool compile under linux.

After removing all CodeTyphon specific components my next move was to try to compile ct2laz under linux (Mint Cinammon Debian Edition with official Laz 1.6.2 and FPC 3.0.0), but I am stuck and need help.

First on compilation I get this error:
Quote
Compile Project, Target: ct2laz: Exit code 256, Errors: 1, Warnings: 1
Warning: Recompiling dynlibs, checksum changed for dl {impl}
openssl.pas(85,3) Fatal: Cannot find dynlibs used by openssl. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/fpc/3.0.0/units/i386-linux/rtl/dynlibs.ppu..

If I then locate dynlibs.pas and add it as a project requirement file I get this:
Quote
Compile Project, Target: ct2laz: Exit code 256, Errors: 1
strings.pp(109,2) Fatal: Cannot open include file "strings.inc"

After adding I386 version of strings.inc file I get such strange compilation errors that it was clear I am on wrong path.

Can anyone help?  ;) %) ;)


Quote
    HISTORY:
    0.9.5.154 Lazarus version is now default (if you want CT version then convert project with it's executable:)
    0.9.5.151 removed CodeTyphon specific components, show message on CSV file missing
    0.9.1.136 initial public release
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: Leledumbo on January 04, 2017, 08:43:19 am
I am asking for help to make this tool compile under linux.

After removing all CodeTyphon specific components my next move was to try to compile ct2laz under linux (Mint Cinammon Debian Edition with official Laz 1.6.2 and FPC 3.0.0), but I am stuck and need help.
I've forked your repo. I'll see what I can do.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 04, 2017, 08:58:33 am
I've forked your repo. I'll see what I can do.
Thank you very much! Any help is most appreciated.   :D
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: JuhaManninen on January 04, 2017, 03:13:43 pm
Can anyone help?  ;) %) ;)
Yes! But damn it was a nasty one.  :o
The fundamental reason is that RTL already has a unit named "dl" in rtl/unix/dl.pp.
Just rename your unit to "mydl" or whatever and it starts to work. After renaming you can test by adding "dl" again to uses section. Ctrl-Click it and see where it jumps. :)

Some notes, although these don't cause errors:
Reference to "sdflaz" is not needed in project .lpr file.
Package "FCL" dependency is not needed, it comes through LCL.
Also the package "sdflaz" is not needed as a project dependency because it is installed in IDE.
Normally an installed design-run-time-packages dependency is needed but now all used units are from FPC libs.

[Edit] I looked at your commit history. "dl.pas" was added with commit message :
 "removed CodeTyphon specific components"
although it looks like a refactoring change where code was moved out of main unit into 2 new units.

A question comes to mind: why was the error message so misleading?
It did not say anything about unit "dl" or the units used by "dl".
The problem was especially difficult to find because clean build (Shift-F9) apparently did not clean everything. I commented out units, also "dl" but the same error still came. By luck I happened to delete the whole project lib folder.
How could such errors be found easier?
Anyway, in this case the name "dl" was a bad choice because UNIX systems have libdl.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: Leledumbo on January 04, 2017, 08:00:26 pm
Yes! But damn it was a nasty one.  :o
The fundamental reason is that RTL already has a unit named "dl" in rtl/unix/dl.pp.
In fact, that's the only "error" before the project builds on Linux. Fork cancelled %)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 04, 2017, 11:29:34 pm
Can anyone help?  ;) %) ;)
Yes! But damn it was a nasty one.  :o
The fundamental reason is that RTL already has a unit named "dl" in rtl/unix/dl.pp.
Just rename your unit to "mydl" or whatever and it starts to work. After renaming you can test by adding "dl" again to uses section. Ctrl-Click it and see where it jumps. :)
Thank you sooooo much! It compiles now! :) :D :)

I will take a look at your project notes and correct them.

Quote
[Edit] I looked at your commit history. "dl.pas" was added with commit message :
 "removed CodeTyphon specific components"
although it looks like a refactoring change where code was moved out of main unit into 2 new units.
Yes. To make it work with just Lazarus components I had to replace some CT only visuals, and completely rewrite downloading and recursive file search to use only what's available in FCL. That was also the reason for refactoring code.

Quote
A question comes to mind: why was the error message so misleading?
It did not say anything about unit "dl" or the units used by "dl".
The problem was especially difficult to find because clean build (Shift-F9) apparently did not clean everything. I commented out units, also "dl" but the same error still came. By luck I happened to delete the whole project lib folder.
How could such errors be found easier?
Anyway, in this case the name "dl" was a bad choice because UNIX systems have libdl.
Indeed it was so misleading that I think I would not have found the error myself in million years. Especially since it compiled well under windows. I really felt like a dummy throwing myself at it in many ways without any progress at all. I will certainly think more careful about naming in the future, but it can be tough sometimes. I mean, I have renamed dl to downloader now but it may also conflict in the future. I guess namespaces will come to the rescue one day...

In fact, that's the only "error" before the project builds on Linux. Fork cancelled %)
Thanks a lot for your time and effort!

Since compilation works now with the great help of JuhaManninen, I guess I will try to finally make ct2laz fully work on linux too. Stay tuned...  ::)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: frakno on January 05, 2017, 12:57:29 am
Great, I tried it.

Worked well,
a few packages compiles but dont work

But e.g. Cindy works really well

Tahnk you really much for your effort
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 05, 2017, 10:05:27 am
Worked well,
a few packages compiles but dont work
But e.g. Cindy works really well
Most packages work. There are few specific to Typhon IDE that won't work, there are some that run only on windows, and there are some that require trunk FPC and/or LAZ, but every package that works in CodeTyphon should also work in Lazarus if they run both on the same pc with the same operating system. There are tons of packages, really - and many have nice examples. The only thing you should check manually for every package you want to use is the license of the original package, since that is not always that clear in CodeTyphon it self. I will probably display such warning message in the future, as one of ct2laz users has already suggested.

Tahnk you really much for your effort
You are most welcome  8)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: JuhaManninen on January 05, 2017, 11:16:45 am
... I guess I will try to finally make ct2laz fully work on linux too. Stay tuned...  ::)
It should be easy because all the code you use from FPC and Lazarus libraries is already cross-platform.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 21, 2017, 07:09:03 pm
From version 1.0 application also works on Linux. :)  ;)  :)

Tested on Linux Mint Cinnamon Debian 32-bit edition. Please report here testing results with your OS and bitness info. To download full source go to the first post. To download Linux or Windows 32-bit binary go to https://bitbucket.org/avra/ct2laz/downloads/.

If you just press "CT => Laz" button without changing default settings, application will download latest CodeTyphon components and CodeOcean examples, and convert them for direct use in Lazarus. That's what most people will use this application for, but remember that it can also convert whole projects, and that conversion works both ways.

Table "replacements.csv" is the hearth of the conversion process, as it holds all package name pairs that differ in Lazarus and CodeTyphon. If for any reason package names change or latest IDE versions bring some new packages, this is the place where you fix things. Then you can send me fixed CSV file, or let me know and I will fix changed/added package name pairs. If the same package exists for both IDEs (like "bgrabitmappack" in Lazarus and "pl_bgrabitmap" in CodeTyphon), but for some reason in Lazarus you want to use CodeTyphon version instead, just replace "T" with "F" (without quotes) in the first CSV table column. This means there will be no conversion for that package so all CodeOcean examples will keep working with CodeTyphon version of that package (which you installed instead of original Lazarus package).

Enjoy and thank you all!  :D

EDIT: link was missing a slash character, now it works as it should
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on February 06, 2017, 12:14:44 pm
News:

https://bitbucket.org/avra/ct2laz/downloads/

EDIT: link was missing a slash character, now it works as it should
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: Akira1364 on February 16, 2017, 09:39:07 pm
Don't know if you've seen this post already, but I thought I'd point it out in case you haven't:

http://www.pilotlogic.com/sitejoom/index.php/forum/ct-lab-news/3758-ct-lab-ver-6-10 (http://www.pilotlogic.com/sitejoom/index.php/forum/ct-lab-news/3758-ct-lab-ver-6-10)

Apparently two of the things PilotLogic has planned for the next version are
Quote
Lab task 0010 : Change Typhon Project Info file extension from "lpi" to "ctpr"
Lab task 0040 : Change Typhon Package file extension from "lpk" to "ctpkg"

So you might want to start factoring that into your development of ct2laz, I guess?
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on February 17, 2017, 08:48:01 am
Apparently two of the things of PilotLogic has planned for the next version are
Quote
Lab task 0010 : Change Typhon Project Info file extension from "lpi" to "ctpr"
Lab task 0040 : Change Typhon Package file extension from "lpk" to "ctpkg"

So you might want to start factoring that into your development of ct2laz, I guess?

Thanks for pointing that out. That case is already partly covered, since file extensions used for search and replace are configurable as can be seen on the attached screenshot. You just need to replace *.lpi and *.lpk extensions with new ones. I will probably wait for a while before making these new extensions default ones, and add a button for old ones. However file renaming is not covered yet. It will be covered soon (ideally before CT 6.1 officially comes out), but for now manual file renaming should do the work after ct2laz has finished conversion.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on May 15, 2017, 12:55:56 am
ct2laz has been updated. Renaming files feature was added, because CodeTyphon 6.10 changed several Lazarus file extensions. It is a must to first delete your old INI file before any conversion.

Sources and overview:
https://bitbucket.org/avra/ct2laz/

Binaries for Windows and Linux and needed CSV file:
https://bitbucket.org/avra/ct2laz/downloads/
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: tigerA15 on May 19, 2017, 04:10:21 am
thanks a lot.
   this tool has a little bug:
    it should change '{$R *.lfm}' to '{$R *.frm}'    :D
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on May 20, 2017, 01:19:23 am
thanks a lot.
   this tool has a little bug:
    it should change '{$R *.lfm}' to '{$R *.frm}'    :D
Thanks for reporting. Only CSV file with replacement pairs needs to be updated for your find. It's too late now for this so I will leave it for tomorrow.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on May 20, 2017, 10:18:30 pm
    it should change '{$R *.lfm}' to '{$R *.frm}'    :D
Fixed. You only need to replace your CSV with new one. Executable is not affected.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on June 15, 2017, 08:34:39 pm
Well, here is one unintended feature: reverting CT 6.10+ project back to 6.00- version.  :-[

Some people have converted their projects to new version, found a spoiler bug, and now can't get back to old CT because they made no backup. Well, ct2laz comes to the rescue. First convert your CT 6.10+ project to Lazarus, and then back to CT but do not check the last 6.10 related checkbox and replace T with F in table column with .lfm} and .frm} in the above screenshot.

Enjoy!  ;)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: sam707 on July 19, 2017, 07:25:33 pm
@avra = your ct2laz works pretty fine to me, so I can ensure that when I write some stuffs with CT they keep compatibility with LAZ! and it is NICE! THANK YOU avra

BUT there is a little 'bug' (prefer to say omission) I wanted to tell =

when I convert from <> to , there I must always manually edit the xml file describing project and change the extension of the main program mannually (CT 6.15, LAZ 1.6.4)

example =

Quote
    </RequiredPackages>
    <Units Count="4">
      <Unit0>
        <Filename Value="snipy.ppr"/>
        <IsPartOfProject Value="True"/>
      </Unit0>
      <Unit1>
        <Filename Value="formmain.pas"/>
        <IsPartOfProject Value="True"/>
        <ComponentName Value="MainForm"/>
        <HasResources Value="True"/>
        <ResourceBaseClass Value="Form"/>
      </Unit1>

in the .ctpr / .lpi file (xml project descr.) your ct2laz does not change the value I marked bold! from .lpr to .ppr

I do this manually at the moment

It's not big deal, i just wanted let you to know
Regards!
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on July 20, 2017, 09:45:27 pm
@avra = your ct2laz works pretty fine to me, so I can ensure that when I write some stuffs with CT they keep compatibility with LAZ! and it is NICE! THANK YOU avra
Thank you very much. :D   You are too kind!  :-[

in the .ctpr / .lpi file (xml project descr.) your ct2laz does not change the value I marked bold! from .lpr to .ppr
Thank you for this bug report. From a quick look, I would need to change some things. One of the initial decisions was to use no parser but very simple string replacements, and storing these replacement pairs in a simple CSV file. As CT decided to move further from Lazarus files I had to distinguish between quoted and not quoted strings, introduce file renaming and several other things. And so far I only needed to replace strings which are looked at as a whole. Solving this bug requires a possibility to replace strings which are not looked as a whole. I have already partially implemented such possibility but never used it in main code logic. The most convenient way to solve this fully seams to expand CSV file with one boolean. That would allow me to leave code pretty generic, avoid handling such specifics in code, and leave data to CSV where it belongs.

Unfortunately, I will probably not be able to deal with this bug before the end of August.  :'(
Cheers!  :)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: sam707 on July 21, 2017, 02:47:34 am
np @Avra, i would have fix it myself by using a xml parser package, but i also have no time atm.. wife, kidos, hollidays (house to remake some walls)

i'm much more busy on hollidays than at work (that kills me hahahaha)

I'd noticed also a "adLCL" and "LCL" requirement failing sometimes, lets keep in touch, when back at my office i'll dl your source code and read it deep

THANK YOU anyway for your great ct2laz  :-*
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on July 21, 2017, 11:21:06 am
i'm much more busy on hollidays than at work
Usually that's not the case with me, but this time I have to convert one old arcade cabinet into MAME cabinet for the kids with custom electronics interfacing original joysticks, buttons and lights. They think it is for them.  ::)

Quote
I'd noticed also a "adLCL" and "LCL" requirement failing sometimes
Please report details once you find a pattern. Patches are also welcome.  ;)

Cheers!
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 01, 2018, 02:50:51 pm
ct2laz has been updated to v1.20. It is now fully compatible with CT 6.30+. Because of the breaking changes you must delete your old INI file (if there is one) and download latest REPLACEMENTS.CSV file. As usual, CSV file and prebuilt Windows and Linux executables can be downloaded here:
https://bitbucket.org/avra/ct2laz/downloads/

I was shocked this time by the amount of changes that PilotLogic has put into trying to differentiate Typhon from Lazarus. Besides more file extensions renaming, some functions having Lazarus in it's name have been renamed, and even XML tags in project groups have been changed. I had to make some significant changes to be able to cover all cases without employing a parser (which would slow down conversion significantly so I will try to avoid it as long as I can). I don't like such differentiation between Typhon and Lazarus, and since you are reading this I guess you don't like it either. I want the freedom of choice, so ctlaz comes to the rescue again. You are safe to start a project in Typhon knowing that you can get back to Lazarus any time. Breaking compatibility with Lazarus was one of the show stoppers for many people, and at the time they have decided to not start any new projects in Typhon. With ct2laz they are on a safe side again, so this is a major benefit that ct2laz brings to Typhon. On the other hand, even pure Lazarus users can benefit from using Typhon components and CodeOcean examples. Some components have bug and cross platform fixes, others can not be found anywhere else. From my point of view, it's a win-win situation for everyone.

By default, ct2laz will convert every known package name. But let's say that you want to use Typhoon's pl_indy instead of original indy Lazarus package, or pl_synapse instead of laz_synapse. That would mean that you would actually want to exclude those 2 packages from the conversion process. That is possible because all conversion pairs are stored in a CSV database table file. All you have to do is to locate their rows in CSV file and change T to F in first column of such rows in the table. That would tell ct2laz to skip such rows. You can do it from ct2laz (grid data is editable), or if you know what you are doing then you can also edit CSV file directly in some editor (it is plain ASCII file, but you must be careful not to corrupt it's structure).

If you already have Typhon installed then you don't have to use downloading option in ct2laz at all. Simply uncheck 2 first checkboxes and put typhon_src.7z (components) and CodeOcean.7z (examples) into conversion process directory. This is what you would like to do also in case when your Typhon is not the latest version and you want to use exactly your already existing Typhon for the process. Because of the breaking changes, for use with CT 6.10 and older it is better to use old ct2laz executables and CSV file. For such needs I have saved them all and you can still find them in Downloads section. For your convenience here is the  direct link (https://bitbucket.org/avra/ct2laz/downloads/Deprecated%20executables%20for%20compatibility%20with%20CT%206.10%20and%20older.zip) to the archive.

If you want, you can even misuse ct2laz as a general files search and replace utility, by creating new REPLACEMENTS.CSV file with your own conversion pairs, and playing with available options on the form.

Previous ct2laz versions had only simple string replacements, and just took care of replacing quoted conversion pairs in one type of files and non-quoted in others. Things got more complicated with CT 6.20 and CT 6.30 so function handlers were introduced. That is the number in 2nd column of the CSV file. As you can see, it can have 3 values but I expect this number to grow in the future:
Code: Pascal  [Select][+][-]
  1. const
  2.   HANDLER_NONE                         = 0;
  3.   HANDLER_FORCE_REPLACE_WITHOUT_QUOTES = 1;
  4.   HANDLER_FORCE_PARTIAL_STRING_REPLACE = 2;
First number 0 is the old ct2laz behavior. The rest (1 and 2) are introduced to handle latest CT changes.

All CT 6.30 components and examples have been tested with 32-bit Lazarus 1.8.1 and FPC 3.0.5 on Windows 10. Some CT components are Windows only, and some are found to work only with trunk versions of Lazarus and/or FPC.

Have fun!  :D ;) :D
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 24, 2018, 12:18:22 am
Important changes since 1.2.0:

1.2.2.219 Fixed resource file handling (.lrs and .ctrs was missing in form edit box). Fixed output handling for new 7zip (added -bb1 switch which is not compatible with old 7zip v9.20 any more). Report error when old 7zip was found or when 7zip is not at expected location. Fixed disabling rename file edit boxes. Changed CSV boolean column values from 'T' and 'F' to more intuitive 'Y' and 'N'. These are breaking changes requiring you to delete old INI file and download new CSV file.

1.2.1.204 Fixed resource file renaming. Added more replacement pairs to CSV file.

https://bitbucket.org/avra/ct2laz/downloads/
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: AWilhelm on September 25, 2018, 12:49:28 pm
I just converted my Project from CT to Lazarus, but when I compile the Project I get the Error-Message

Code: Pascal  [Select][+][-]
  1. win32int.pp(8,84) Fatal: Cannot find Win32Int used by Interfaces, incompatible ppu=C:\lazarus\lcl\units\x86_64-win64\win32\win32int.ppu, package LCL

Any idea how to solve this?
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on September 25, 2018, 05:57:08 pm
...incompatible ppu...
usually means that you have left overs from another version of Lazarus or CT. Try to clean build all, or try to build with another version of Lazarus.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: witenite on June 20, 2019, 09:26:26 am
Hi Avra,
greetings from New Zealand. I downloaded and installed your ct2laz program and used it to convert a Lazarus project (demo source code from a 3rd party company) to CT. It practically worked "straight out the box". A very big thank you for your efforts in making this program, otherwise I was going to be up for many hours doing a manual conversion of questionable success.

Note I use Linux (Ubuntu 18.04) as my main workstation, so I was very pleased to see you have a Linux compiled option. Worked perfectly apart from the fact that it crashes right at the end with an error (Unable to create file "session.log"). Fortunately it does not appear to affect the actual conversion process. I've tried giving full read/write access rights to the install folder, but that hasn't helped, so I am not sure where it's trying to save the log file.

1 other thing to clarify: I see several times you mention that you MUST delete the ini file every time you do a conversion. Am I correct in thinking this is the ct2laz.ini file? Must this be deleted everytime before doing a conversion from Lazarus to CT or vice versa, or do you mean only whenever upgrading from one version to the next of ct2laz? It seems strange to need to delete an ini file for the program every time you use it to do a conversion.

Apart from these couple of very minor irritations, the programs is superb, thanks again for your efforts.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on June 21, 2019, 08:57:32 am
Hello witenite,

Thank you for your kind words. I am always glad to hear that ct2laz helped someone.

Note I use Linux (Ubuntu 18.04) as my main workstation, so I was very pleased to see you have a Linux compiled option. Worked perfectly apart from the fact that it crashes right at the end with an error (Unable to create file "session.log"). Fortunately it does not appear to affect the actual conversion process. I've tried giving full read/write access rights to the install folder, but that hasn't helped, so I am not sure where it's trying to save the log file.
Could you please run it with sudo and report back if anything is different? If you do not trust executable, then you can build your own from the project. It should be easy since it does not use any 3rd party components.

1 other thing to clarify: I see several times you mention that you MUST delete the ini file every time you do a conversion. Am I correct in thinking this is the ct2laz.ini file? Must this be deleted everytime before doing a conversion from Lazarus to CT or vice versa, or do you mean only whenever upgrading from one version to the next of ct2laz? It seems strange to need to delete an ini file for the program every time you use it to do a conversion.
You only need to do it when you are upgrading an executable when something new is added to ct2laz.ini file structure. The reason for this behavior was to avoid complicated INI handling. I did not want to write code to detect missing INI items and then react. I simply used TIniPropStorage and let it do all the work. I will see if I can make it more clear and rephrase it to avoid further confusion.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on November 15, 2020, 05:28:01 pm
It's upgrade time. ct2laz has been updated to v1.4. It is now fully compatible with CT 7.2+. It is advised to delete your old INI file (if there is one) and download latest REPLACEMENTS.CSV file. As usual, CSV file and prebuilt Windows and Linux executables can be downloaded here:
https://bitbucket.org/avra/ct2laz/downloads/

1.4.0.230   Adapted download files naming to new CT 7.2+ 3 digit numeric increment multipart file extension for components and examples archives, so direct download from Pilot Logic site works again. Fixed INI storage to also save rename files checkbox status between sessions.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: JanRoza on December 28, 2020, 04:53:09 pm
Hi Avra,

Your conversion is not converting CodeTyphon TSQLQuery correctly, CT has an extra property 'Macros' which Lazarus has not.
See the attached error message after loading a converted CT project in Lazarus.
Otherwise your tool works flawless, it's a great help!
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: JanRoza on December 28, 2020, 05:20:06 pm
Another missed property is "ShowMaximized" in the CT version of TfrReport which is not known in Lazarus.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on December 29, 2020, 09:05:21 am
Your conversion is not converting CodeTyphon TSQLQuery correctly, CT has an extra property 'Macros' which Lazarus has not.
CT uses trunk FPC and trunk LAZ. This usually means that there are changes which do not exist yet in official Lazarus, or fpcupdeluxe based one like fixes or some older version. Even 2 trunk versions which are few months apart may have huge differences in certain areas (be it in FPC or be it in LAZ).

Saying this, my guess would be that in particular cases you mentioned, TSQLQuery and TfrReport have moved forward in their trunk versions, and that such properties simply do not exist in LAZ/FPC combo you are using.

That is a never ending race, and ct2laz can not fix that and never will be able to do it. If those are properties stored on forms, your best bet would be to delete them in some external text editor and then try loading to older LAZ/FPC. If properties are in code, then for start simply comment them out, and then try to figure out if that was enough or not. If you have lots of forms having such properties, then you may want to extend replacements.csv with your own replacement pairs. It is a simple text replacement, but if you are in doubt ask here.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: JanRoza on December 29, 2020, 11:18:21 am
Thanks Avra, I understand the continueous battle to keep ct2laz uptodate.
Your suggested solution is exactly what I did yesterday, I edited the lfm files with Notepad++ and after that the projected loaded and ran correctly in the latest stable  Lazarus version.
It just shows what a great help ct2laz is when using both CodeTyphon and Lazarus.
I use CodeTyphon mostly because I like its IDE more than the Lazarus one, it is just a pity that CodeTyphon is moving away further from standard Lazarus with each new release. But luckily then there is still ct2laz to keep the link between the two products alive.  ;D
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on December 29, 2020, 11:33:01 am
Thank you for your kind words.

If you need to move the same project from CT to LAZ and vice versa over and over again, then I suggest to extend replacements.csv with your own replacement pairs. That would eliminate the need for external editor. Once you change version of CT or LAZ, you just need to test if your custom replacement pair is still needed.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: zeljkoc on December 29, 2020, 05:48:03 pm
good work, my support
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on December 30, 2020, 08:03:56 am
good work, my support
Thanks!  :)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: kofccp on January 11, 2021, 02:54:56 pm
I try to install unidac component on Codetyphoe7.2, that component has a lazarus package and I use CTCenter convert tool to convert it to CT package,when I installed the converted pacakage, I got the error message : DADesign.lrs(141,1) Error: Identifier not found "LazarusResources"
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: kofccp on January 11, 2021, 03:10:17 pm
then I try ct2laz,The problem remains the same, can it be solved?
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: wp on January 11, 2021, 03:43:43 pm
Since you want to convert to CT, you should post your question in the CodeTyphon forum - they should know how to do this because most of their packages once were Lazarus packages. ct2laz is a tool to convert in the other direction, from CT back to Laz.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 11, 2021, 04:16:08 pm
You might try something from here:
https://duckduckgo.com/?q=Error:+Identifier+not+found+"LazarusResources"&ia=web (https://duckduckgo.com/?q=Error:+Identifier+not+found+"LazarusResources"&ia=web)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on January 11, 2021, 04:24:28 pm
ct2laz is a tool to convert in the other direction, from CT back to Laz.
Although name suggests that ct2laz does only one way conversion, it can actually convert both ways since CSV file holds conversion pairs, and string replacement doesn't care much about direction. You either choose [CT => LAZ] or [LAZ => CT] button. However, for a long time [CT => LAZ] is the only one I really care and spend time testing.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: kofccp on January 20, 2021, 06:52:42 am
Thanks Avra for helping me find the solution:LazarusResources=>TyphonResources
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: daragor on July 28, 2021, 01:49:19 am
hi avra, this app not work today.. i try install packages exported in lazaurs (ct 2 laz) and result an error.. please u have any solution¿?

sorry my english is poor...  %)
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on July 28, 2021, 02:13:54 am
hi avra, this app not work today.. i try install packages exported in lazaurs (ct 2 laz) and result an error.
You have to be more specific. What packages? Yours or CT's? What CT version? What Lazarus version? Bitness?

ct2laz can not always make 100% conversion. That is the reason why I have created ct4laz (https://bitbucket.org/avra/ct4laz/src/master/) which you can find in OPM (pl_* packages). I have described there the conversion process, and if you take a look at powershell script, *.list files, \files dir and \old.working.dir, you will see that many files needed a manual patch, or an older file version. This is understandable if you know that CT goal is trunk of both FPC and LAZ, while my goal is official version of FPC and LAZ. I do update ct4laz in OPM from time to time, but it is not that often. Who needs latest version and can't wait for my update, can follow the procedure I described and try to patch on his own for successful compilation.
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: jaz2014 on February 14, 2022, 10:28:43 pm
Just a big thank you Avra for ct2laz
I downloaded pl_cindy from your repo and was able to convert
to the latest lazarus with no problems.

Very useful program - thanks

jaz
Title: Re: ct2laz - convertor between CodeTyphon and Lazarus
Post by: avra on February 15, 2022, 02:03:06 am
Just a big thank you Avra for ct2laz
You're most welcome.  :D

I downloaded pl_cindy from your repo and was able to convert
to the latest lazarus with no problems.
Do you know that there is pl_cindy already converted with ct2laz/ct4laz and ready to be installed directly from OPM (Online Package Manager) so you do not even need a manual repo download? You have to use my tools directly only if you want to convert project from/to CT, or if you need a specific CT package which I do not keep in the repo.

Have fun!  ;)
TinyPortal © 2005-2018