[Lazarus] Challenge of converting a Delphi project

Samuel Herzog sam_herzog at yahoo.com
Tue May 4 21:35:13 CEST 2010



They way I format the my source-code and and ess-model is a good example why such things are important

Original:
******
procedure TessConnectPanel.DblClick;
var
  found: TControl;
begin
  inherited;
  found := FindLCLWindow(Mouse.CursorPos);
  if Assigned(found) then
  begin
    FindManagedControl(found);
    if found <> Self then
      TCrackControl(found).DblClick;
  end;
end;

The same with my formating-style:
**************************
procedure TessConnectPanel.DblClick;
var
  found: TControl;
begin
  inherited;
  found := FindLCLWindow(Mouse.CursorPos);
  if not Assigned(found) then exit;
  FindManagedControl(found);
  if found = Self then exit;
  TCrackControl(found).DblClick;
end;

Much better to read, and you see at once, that "FindManagedControl" looks strange!

There is only one rule that applies for all programmer's! We read source-code from top-down. 
That's why I try to avoid "else"-statements.





________________________________
Von: Juha Manninen <juha.manninen at phnet.fi>
An: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org>
Gesendet: Dienstag, den 4. Mai 2010, 10:12:25 Uhr
Betreff: Re: [Lazarus] Challenge of converting a Delphi project

  
Samuel Herzog wrote:
> I compiled ess-model from your git repo on win32.
> Had to add 3 TODO's to make it compilable for win32.
> 
> Tried to commit the changes to your git-repo.
> It was the first time I used git and it looks like my user-settings were not
> very good. The name used to commit was "master". I have changed my settings
> so next time it should be better.
> 
> That's it for the moment. Will play around with the sources as soon as I
> have some spare time.
No, you can't commit (push) your changes directly to my repository.
The GitHub "free plan" account allows only one personal repository and no other direct committers. However, it allows you to fork any number of existing repositories, change them and then send pull requests.
The flow is explained nicely here:
http://jagregory.com/writings/git-remotes-contributions-and-the-letter-n/

I am also learning this now and I would be happy to test with your pull request. It should be easy:
First, at http://github.com:
1. Create a "free plan" account.
2. Find my Pascal repository.
3. Click the Fork-button. Now you have a forked Pascal repo.
Then at your machine:
$ git clone git://github.com/YourName/Pascal.git
Edit code ... git commit ... repeat if needed.
$ git push origin
Then again at http://github.com:
Select your forked Pascal repo and click "Pull Request" button. There should be my name selected automatically.
It is actually cool. I was wondering how git users can pull from each other when most people have dynamic IP addresses. GitHub is one way to solve that.
> Thank you very much for your incredible work you did for the DelphiToLazarus Convertion stuff !!!!
Thanks for the positive feedback but the converter is not so incredible yet. The form file conversion fails on most non-trivial Delphi projects. Needs much more work.
The converter will never be perfect. I mean it can't do a fully automatic conversion. This EssModel prog is a good example. I can't convert it even manually after days of debugging. It would never happen automatically.
Regards,
Juha

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100504/ac6bece8/attachment-0004.html>


More information about the Lazarus mailing list