Recent

Author Topic: ptop config file for Delphi style guide  (Read 397 times)

pleumann

  • Full Member
  • ***
  • Posts: 109
ptop config file for Delphi style guide
« on: May 29, 2026, 11:44:26 am »
Hello,

I'm trying to reformat a really large, old codebase with ptop. I'd like the output to be as close to Delphi's style guide as possible. Is there already a config that does this? One point I'm struggling with in particular is the weird indentation of whatever follows an "else if" because it uses the column of "if" as a base, not the one of "else", so things will be too far to the right.

Best regards
Joerg

jamie

  • Hero Member
  • *****
  • Posts: 7765
Re: ptop config file for Delphi style guide
« Reply #1 on: May 29, 2026, 01:06:03 pm »
Assuming you are using Lazarus, you can figure Jedi code formatter to align to your liking.
 That would be under the SOURCE menu near the bottom.

Othewise i dont think you are going to get much.

Jamie
The only true wisdom is knowing you know nothing

Fred vS

  • Hero Member
  • *****
  • Posts: 3945
    • StrumPract is the musicians best friend
Re: ptop config file for Delphi style guide
« Reply #2 on: May 29, 2026, 02:29:38 pm »
Hello.

You may use https://github.com/fredvs/xtop.
It includes ptop (without memory leak and with extended features) and config file ptop.cfg.
« Last Edit: May 29, 2026, 03:02:29 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

pleumann

  • Full Member
  • ***
  • Posts: 109
Re: ptop config file for Delphi style guide
« Reply #3 on: May 31, 2026, 10:18:12 am »
Assuming you are using Lazarus, you can figure Jedi code formatter to align to your liking.
 That would be under the SOURCE menu near the bottom.

Othewise i dont think you are going to get much.

Jamie

Thanks for the hint! I do use Lazarus, so that's definitely an option. The codebase comes from a different, ancient Pascal compiler, though, and is not syntactically correct Free Pascal. Hence Jedi fails. But I could probably apply the formatting after the conversion (I was hoping to apply it before).

pleumann

  • Full Member
  • ***
  • Posts: 109
Re: ptop config file for Delphi style guide
« Reply #4 on: May 31, 2026, 10:19:28 am »
Hello.

You may use https://github.com/fredvs/xtop.
It includes ptop (without memory leak and with extended features) and config file ptop.cfg.

Thanks for the pointer! What extended features would that be? I had a quick look at the code and README.md, but couldn't see what was added on top of "vanilla" ptop.

Fred vS

  • Hero Member
  • *****
  • Posts: 3945
    • StrumPract is the musicians best friend
Re: ptop config file for Delphi style guide
« Reply #5 on: May 31, 2026, 04:29:01 pm »
Hello.

You may use https://github.com/fredvs/xtop.
It includes ptop (without memory leak and with extended features) and config file ptop.cfg.

Thanks for the pointer! What extended features would that be? I had a quick look at the code and README.md, but couldn't see what was added on top of "vanilla" ptop.

Mainly extended errors manager, added "comma" keyword and fixed memory leak.
There is configuration.txt to explain how to use it.

Note that my last commit was 6 years ago and it is possible that the memory leak has been fixed since then; I have not checked the latest official FPC commits.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Roland57

  • Hero Member
  • *****
  • Posts: 609
    • msegui.net
Re: ptop config file for Delphi style guide
« Reply #6 on: May 31, 2026, 05:45:49 pm »
The codebase comes from a different, ancient Pascal compiler, though, and is not syntactically correct Free Pascal. Hence Jedi fails.

Hello! You could also try out PCF (a command-line tool derived from Delphi Formatter Expert by Egbert van Nes).
My projects are on Codeberg.

 

TinyPortal © 2005-2018