SourceForge Logo


JEDI Code Format

Version 2.43

January 2009


The following Sourceforge pages are available:

What does it do?

The formatter can standardise all aspects of Delphi Object Pascal source code formatting, including indentation, spacing and capitalisation. If you are still not sure, see the examples of program input and output . It works on Delphi and Delphi.NET syntax.

Why use a code formatter?

It is useful if you are taking over code and don't like the original formatting. It is useful if you are trying to bring code from multiple sources to one standard.

A human can always produce better formatting than a program, but in many cases they don't. If you find a piece of code's formatting annoying or hard to read, this program can save you a lot of time.

On your own code it can catch your mistakes, and even automate some mundane tasks that may have annoyed you but you haven't bothered with up to now (e.g. to turn tabs to spaces, standardise  indentation, spacing and capitalisation, globally change a variable or procedure name, globally remove redundant unit from all uses clauses, or even to insert the MPL licence comment into all units).

How should I format my Delphi programs?

You should format your Delphi programs as per this program's default settings, i.e. as Borland suggests.

Licence and disclaimer:

This program is free and open-source.

As of version 2.37, JCF is avaialble under a dual licence -  Mozilla Public Licence (MPL) 1.1, or GPL 2.0 or later.

The original licence was the MPL - I chose the MPL particular open-source license at the suggestion of the Delphi-JEDI group. the GPL was added at the request of members of the Lararus project, who use this licence, and would like to link in JCF code.

If you improve this program in any way (bug fix, new feature, better algorithm, whatever), I would appreciate it if you send those improvements back to me for possible inclusion in a future version.

Disclaimer: This program may have bugs or not yet fully meet it's design objectives. Although it has been fairly well tested and is used with some success, I cannot make any guarantees. If you care about the quality of this program, send in bug reports.

I recommend using a source control system such as Subversion Microsoft TFS, CVS, TeamSource or the like. Remember "Source control is like flossing - you don't have to floss all your teeth - just the ones you want to keep." If you are still not using such a tool, please make backups before using the formatter.

How to install

This version is downloadable as source or as executable.

Install the executables as follows:

The Delphi IDE pluggin can be installed for Delphi 7 as follows. All packages can be installed by selecting the menu item Component|Install packages and clicking the "Add" button.

Install the source as follows:

Things that can go wrong with compilation:

How do I report a bug?

Report the bug here. Submit a test case and (optionally) a fix to the source, and tell me which if these categories, ordered by severity, that you think the bug falls into:

  1. Program error: The program crashes (access violation, assertion failure, etc.) or aborts when given your test case.
  2. Bad output: The program gives output that does not compile when given your test case.
  3. Lousy formatting: The output compiles but looks bad. Give an example of input code that is badly formatted, and preferably a fix. 
  4. Non-standard formatting: The output is readable but not compliant with the agreed standards. Give an example with your test case of what you think the output should be, and preferably a fix. 
  5. Missing option: The formatting that you want is not standard, but it's how you do it and the formatter does not support it. If you don't give a fix that adds your favourite option, give an example with your test case of what you think the output should be.

What to do if you don't like this program

Breath. Calm down. Remember that I am offering this program free and without any guarantees. Remember that I did not force you to use it. Remember that I strongly suggested that you make backups. Constructive suggestions, especially those with code, will be kindly treated. Flames will be deleted. I haven't had any flames yet for this program, and I'd like to keep it that way.

Where is the program going?

This program is mostly in maintenance mode now - I fix bugs, track changes in Delphi versions and language syntax, and release an update every month or two.

The goal for Version 2.0 is that the program should have no bugs and generate output compliant with official code formatting standards (and have options for other styles). It should allow the user to configure anything that needs to be configured, and it should not overload the user with useless options.

It should also have, in order of priority: readable source, an easily extendable and well-documented architecture, and should run fast enough.

Can I get involved?

Yes, please do. Report a bug. Request a feature. Download the source, compile it, and fix a bug or add a feature. If your addition is sound it will be included in the next release and your name will be listed. If you want to be added to the Sourceforge project developers list, do this first, then we'll talk. I'm not interested in adding people the project's developers list just because they want the status of being there. I am interested in giving that status to people who have proved that they can and do add something of value. I am a bit sceptical of wild verbal enthusiasms. To paraphrase Bruce Sterling, it doesn't take youthful enthusiasm, it takes dogged middle-aged persistence.

However bear in mind that this is open source software. If you want to play with the code, forge ahead in your own direction or just or roll your own version of JCF, go right ahead.

What other Delphi code formatters exist?

What other Delphi code tools exist?

You could look for Delphi code tools at The inner circle project
You could look for the API translations, code library and components at The Joint Endeavour of Delphi Innovators (project JEDI).
GExperts  is Open source programming tools for Delphi and C++ builder. Not only are they good tools, the source is good examples on how to do this kind of thing.
There are several sites that act as clearing-houses for Delphi shareware, components and free code.

Does JCF just work on Delphi code?

Yes, it is designed with only Delphi in mind. However it may work on other dialects of Pascal. I have no way to test this as I only use Delphi, but if you have any luck, let me know. If you would like JCF to support a syntax element from another dialect of Pascal, then send me a code sample please! 

For other languages such as C, Java and so on - do a search on the web and you will probably find a selection of tools.


Contact me via the forums