PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Source code formatter  (Read 104 times)

pwhirley

  • Silver Member
  • ***
  • Posts: 21
    • View Profile
Source code formatter
« on: May 01, 2024, 05:03:09 PM »
Has anyone out there written a source code formatter for PXPlus programs?  I use Eclipse with a plug-in developed and maintained by Fred McGuirk.  It does a great job of decompiling PXPlus programs into text source, but it does not attempt to do any pretty formatting.  I am considering writing a tool to do the formatting (i.e. remove LET, replace "THEN" with "{", indent IF and loop constructs, etc).  I don't want to write it if someone else has already done so.

Phil
Philip Whirley
Freelance software developer
phil@whirley.org

Mike King

  • Diamond Member
  • *****
  • Posts: 3820
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Source code formatter
« Reply #1 on: May 01, 2024, 05:27:00 PM »
There is one built into ED+.

Simply load the program into ED+ then select Tools >> Reformat from the menu bar. 

You can then save the resultant as a sequential file.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Josh Fake

  • Member
  • **
  • Posts: 14
    • View Profile
    • Earnest & Associates
Re: Source code formatter
« Reply #2 on: Today at 08:41:20 AM »
Mike/Phil,

If I remember correctly with ED+, applications and programs that use line numbers would renumber not maintaining the original line numbers.  It's been a long while since I tried utilizing ED+ but it was too cumbersome to use with the application I modify and maintain.

I would LOVE to see an add-on to either Notepad++ or Visual Studio Code (Preferred) for PxPlus.

Allen Miglore

  • Silver Member
  • ***
  • Posts: 39
    • View Profile
    • UnForm
Re: Source code formatter
« Reply #3 on: Today at 10:15:51 AM »
*IT is much better at working with programs with line numbers.  ED+ just treats the line numbers as part of the code, with no functionality to renumber or maintain auto numbering as you insert lines.  What I wish *IT had was code formatting with indention of loops and {} if blocks (and code folding would be nice too).  It's easy to get lost in long, deeply nested sections.  I work with both, depending on if I'm willing to remove line numbers, which for much existing code I can't.

pwhirley

  • Silver Member
  • ***
  • Posts: 21
    • View Profile
Re: Source code formatter
« Reply #4 on: Today at 10:56:24 AM »
Thanks for the input.
I have not used line numbers in my code in many years, so changing line numbers doesn't bother me at all.  I also haven't used ED+ in many years, but I'll check it out and see if I can make use of it.  I really don't want to have to load individual programs to reformat them.  I would prefer to be able to process a whole folder full of source text at once.

Josh, you might want to check out the Eclipse plug-in.  Notepad++ is a good editor, but Eclipse is a full-featured integrated development environment which you can use at no cost.  With the plug-ins available (https://eclipse.sagemas.com) you get a decent editor and the ability to decompile programs, recompile with error flagging, a to-do list, very sophisticated search tool, integration to SVN or Git and much more.  You can automatically save your programs, classes and libraries to multiple locations such as a project space and a test system.

I'll let y'all know if I write something to format or if I figure out how to automate the existing ED+ tool.

Phil
Philip Whirley
Freelance software developer
phil@whirley.org

Len Vassos

  • Administrator
  • Gold Member
  • *****
  • Posts: 95
    • View Profile
Re: Source code formatter
« Reply #5 on: Today at 11:03:16 AM »
Thanks for all your input.

Based on feedback from our developer community, we will be introducing a PxPlus extension for Visual Studio Code in PxPlus 2024 which is scheduled to be released later this month.
PVX Plus Technologies, Ltd.