A lot of the translation was done manually in this case. But a lot of it was as you describe - find and replace. Some of the direct Windows API calls were a bit problematic, but nothing that an experienced coder can't resolve quickly.

One interesting discovery he made was that it's possible to cut and paste controls from forms in Rad Studio into lazarus! That saved a lot of time ...

Another interesting issue was the fact that includes in C++ aren't exactly "uses" in Pascal - placement matters, and some things had to be manually fiddled to get them just right. Good unit design in C++ helped a lot, too.

It certainly wouldn't be impossible to get a C++ Builder to Lazarus converter going - you'd never get it perfect, but hey - that's what compiler errors are for, eh? ;>) And with some 50 programs yet to translate, we'll probably be doing something like that. If we do, I'll be sure to put the script/source up somewhere and let you folks know. If anybody else already has such a thing, by all means, feel free to share!

Be well,
Dave H.


On Mar 7, 2010, at 9:28 AM, Juha Manninen wrote:

> We've been using C++ Builder ...
> [...]
> Native compilation - check. Native look and feel - check. Similar
> object structure to our existing code base - check.
and easier and clearer language syntax - check.
> A colleague moved a rather complex software update tool from C++
> Builder to Lazarus in 4 days - and we now have a Mac version as well.
> That, my friends, is nothing short of incredible.
Hmmm... how did he convert the source code?
Is simple find/replace enough or does it need lots of editing?
By replace I mean :
'{' --> begin
'}' --> end
'->' --> '.'
&param --> var param
*param --> var param (I guess)
Remove '*'
etc. direct syntax changes.
If that works then it could be implemented in a future version of Delphi converter, making it "Delphi / C++ Builder converter".
Ok, it needs some parsing for sure. Like:
bool myclass::myfunc(otherclass *param)
must be changed to:
function myclass.myfunc(param: otherclass): boolean;
which already needs a parser. But if it needs a full C++ parser then it becomes complicated and may not be worth the effort.
Regards,
Juha Manninen
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to