Delphi code formatter - delphi

Are there any utilities that reformat Delphi code ?
EDIT
I am using Delphi 2006
Some feedback
Thanks to all that answered this question
I have been using the JCF code formatter - it works well and my code is been formated to Object Pascal Style Guide

You can try the "Jedi code Format". See more information here: http://jedicodeformat.sourceforge.net/
The formatting engine of DelForExp has been integrated into the code base of GExperts. An experimental version of GExperts including a "Code formatter" here:
http://blog.dummzeuch.de/experimental-gexperts-version/
Separate information/downloads for DelForExp here.
Regards.

I have been for some time releasing experimental GExperts versions that include the code formatter formerly known as DelForEx with some improvements and fixes. The latest release is from 2020-10-23 and supports the following Delphi versions:
Delphi 6 to 7
Delphi 2005 to 2010
Delphi XE
Delphi XE2 to XE8
Delphi 10 to 10.4
Delphi 11 (Danger, Alpha version for now 2021-10-24)
Please note, though, that I am using it only with Delphi 2007, so the other versions may have unknown bugs. Also, not all language improvements of later Delphi versions will work, e.g. nested types, generics and anonymous methods.
see gexperts.dummzeuch.de for details.
btw: Any help improving the formatter, especially adding the new language constructs would be appreciated. The source code can be downloaded from the subversion repository linked from my homepage.

I found this: JEDI Code Format

lextudio - Code Beautifier Collection 6 for CodeGear RAD Studio 2007
http://code.google.com/p/lextudio/

Yes,
I always used TWM's experimental version os GExperts which support this feature.
In Delphi 2006 and 2007 it works perfectly (Don't know about older versions though).
The current version is adding support to Delphi 2009, but I don't know in which stage it is, you can find more about it here:
http://www.dummzeuch.de/delphi/gexperts/english.html

BTW: There is an integrated Source Code Formatter since Delphi 2010.

Free Pascal also has a codeformatter, ptop, but it only implements the more basic dialect (say D4-D6 level).
Lazarus recently changed to use the Jedi codeformatter afaik.

The TWM version of GExperts works well and is nicely integrated into the IDE. It enables you to write and modify your code without worrying too much about exact formatting, then just hit the assigned hot-key and it instantly reformats. I have always found it easy to set up to match the style I prefer, and not as complex as JEDI Code Format, which looked like overkill to me.
The Delphi 2009 version is now available from the link posted above, though based on a beta release of GExperts. It is still much the same formatter underneath, though, and is unaware of the syntax of some of the newer Delphi enhancements.

I just made an online pascal code beautifier based on JCF. You may try it at https://pak.lebah.web.id/jcf
HTH.

There is OPEdit II which is free, and works very well.
It's a full text editor, with code refactoring and code browsing.
There is a text formatter, which uses the internal code parser, therefore handle conditional defines just as a real Delphi compiler.
See http://www.codefactor2.com

There is a program PascalFormat

Related

Best Delphi freeware compiler in user friendliness

I am working on a C++/Win32 project, and I have some Delphi code from some other (not mine) project that is relevant, and I want to convert it to C++ and integrate into my project.
Keep in mind I have no experience with Delphi.
What's a good and user-friendly Delphi complier? I don't mind about command line or GUI, as long as it's clear to use.
The only Delphi compiler is the Delphi compiler. It's not free. There is the Free Pascal Compiler, FPC. That is, as its name suggests, free. FPC can compile most Delphi code but be aware that many Delphi libraries, e.g. the VCL, are not available for FPC.
I do not know whether this would be too painful for you you to convert the source code in C++ manually.
But have you tried Lazarus? It is intended to be an open source equivalent of Delphi.
Hope it helped.
The previous responses here were all valid in 2012, but things have changed.
Nowadays there is a free (as in beer) Community Edition:
https://www.embarcadero.com/products/delphi/starter/free-download

Windows & Mac XML library for delphi XE2

What is the best (easy to use, performances) library to manage XML on Delphi XE2. Windows and Mac targets in mind.
I usually go for the NativeXML library, it's an XML library completely written in Delphi code and it's free. I'm not sure if the latest version offers compatibility with the Firemonkey platform, but with a few changes to unit names I tested it successfully back when Delphi XE2 was first released.
You can find the component here: http://www.simdesign.nl/xml.html
In case the latest version isn't compatible with XE2 yet, there's a topic on the forums about how to make it compatible: http://www.simdesign.nl/forum/viewtopic.php?t=2110
You can use OmniXML, it is:
100% written in delphi
Has no outer dependencies
Works on XE2, did not test it on OSX
On top of OmniXML you can use SimpleStorage to give you more power and simplicity managing the XML.
Andreano Lanusse has a nice blog post on using XML on Mac. It turns out that:
When you drop a TXMLDocument component on your design the default DOMVendor MSXML, you have to change to ADOM XML v4 to support cross-platform.

"Delphi Fundamentals" in Delphi 2009

Has anybody used/converted "Delphi Fundamentals" in Delphi 2009? - http://fundementals.sourceforge.net/
I'm using Dictionaries (cArrays.pas,cDictionaries.pas,cStrings.pas,cTypes.pas) in my project and now i have some troubles on upgrading code.
I'll be highly obliged if anybody can convert the above mentioned units in Delphi 2009. I'm quite new to Delphi, started working with 2007 and 2009 has been released, I just cannot help myself...
Thank you
I use cUtils, cDateTime and cStrings in a project.
After a 30 minute session of searching and replacing like a madman I got them to compile in Delphi 2009, with just a couple of warnings left to fix.
Char>>>>AnsiChar
String>>>>AnsiString
PChar>>>>PAnsiChar
PString>>>>PAnsiString
It passes all of its selftests, and so far things seem to work fine. I've shared it here: http://www.xs4all.nl/~niff/Fundamentals_UtilsD2009.zip
Update
I've added a ported cDataStructs.pas to the zipfile, which contains the dictionary classes. This one still has a lot of compiler warnings that you might want to fix, but the self-tests pass, so you could try and see if it works for you..
There is no official version of Delphi Fundamentals for D2009 (and I think there never will be any).
I think it would be the best option to rewrite the dictionary code using the Delphi-native TDictionary<TKey,TValue> class inside Generics.Collections.pas, or using the delphilhlplib (Collections/DeHL.Collections.Dictionary.pas).

Delphi IDE - CodeRush visual "connectors" alternative

I used to work in Delphi 6, and got very used to having CodeRush's various helpful IDE additions. Many are now in the IDE itself, or I've managed to replace with something else, but the one feature I REGULARLY find myself wishing I had in Delphi 2007 still, is the ability CodeRush had that added little "connecting lines" between components that were linked to each other (lines showing the connections between TDataSets and TDataSources, for instance).
Does anyone make something that does that in the newer Delphi IDE?
=== * LATER NOTE / Clarification * ===
Andreas is correct in his comments below... "I don't think that he meant structural highlighting which works on the source code. He wants "connection lines" between components in the form designer."
He also says "as far as I know there is no such tool for Delphi 2005 or newer".. which is a bummer if true. (...and if that IS the case, what's the best place to make Delphi IDE feature requests?)
I don't think it exists. The best place to make form designer feature requests is here.
another freeware/opensource option would be to look at CNPack which supports structural highlighting and runs well in Delphi 2009. The library contains many other enhancements to the IDE also, some which are duplicated in other packages such as GExperts. I run both CNPack and GExperts in both 2009 and 2006 without any problems.
You want Castalia, which works fine here on my D2007 for structural highlighting.
Castalia from Twodesk

Delphi 2009 TurboPower library conversions

In the next few months I will be resurrecting a project which made extensive use of Orpheus and SysTools. The development system I used is long gone, so would like to update the libraries to my current development environment.
My question(s): is anyone porting, or has anyone ported the TurboPower libraries to Tiburon, if so did you encounter any problems; and if the answer is nobody, is it worth collaborating to produce a Delphi 2009 version, sharing the load.
Some components in the process of being ported to Delphi 2009, including 5 TurboPower libraries. No Orpheus or SysTools, though.
http://www.songbeamer.com/delphi/
Update:
As M Plaut pointed out, Orpheus has been added to the site and has been updated as recently as Nov 13.
Orpheus407AU_3 was posted at http://sourceforge.net/projects/tporpheus/ on Sept 5, 2009.
There is Orpheus project at SourceForge but last release was made in 2005 :(
Systools is also to be found there.
When turbo power closed their doors, I analysed my code that was using Orpheus and SysTools. I found that there were only a handful of SysToosl functions I was using and so we wrote our own functions. (Can't remember what they were)
It was fairly straight forward, some of them were in the newer versions of Delphi and the rest were easy to code.
Orpheus was a little more difficult. I would be willing to throw some time into bringing back Orpheus. We replaced it with standard Delphi components and some code, but our applications lacks some of the coolness it once had.
We would definitely be looking to port this as well. We use alot of Orpheus components in our current applications and this would be a definite roadblock to Delphi 2009.
As of 10-11-2008, there is a version at http://www.songbeamer.com/delphi/
of Orpheus as well. The following comments are attached:
This is based on the version from CVS. The first two packages compile and are partly tested. Some asm code still needs updating. Some bugfixing also need to be found and fixed. Contributions are welcome (use the contact form on the top). Search for "FIXME" in the source.
Files that may need special attention and bugfixes: OVCDRPVW.PAS, OVCPF.PAS, OVCEDITU.PAS, OVCVIEWR.PAS, OVCSTR.PAS
I have to bring a very old project to delphi 2009 : a CNC editor. The project didn't use Orheus at that time, but I was looking into it (did some tests), and the orpheus text editor is still the fastest on the market. So yes, I am very interested. I tried to compile the old source in delphi 9, but it crashes.
I am not a good programmer, but I can do tests for you.

Resources