DUnit Folder Iterator Extension

 Delphi, GExperts  Comments Off on DUnit Folder Iterator Extension
Dec 282019
 

In 2012 Uwe Raabe blogged about an extension to the DUnit framework he had written. He mentioned it today in the German Delphi Praxis forum.

Guess what? It’s brilliant. It does exactly what I always wanted to write (and never came around doing) for the Unit Tests of the GExperts Code Formatter.

Those tests basically consist of a set of input files in one directory and for each of the tested configurations another set of files with the expected output. It always irked me that I actually had to write some code every time I added a new test instead of simply adding another bunch of files.

Today I changed those tests to use Uwe’s unit (with a few modifications to make it compatible to Delphi 2007). And I found that there were quite a few files which didn’t even get tested at all, because I forgot to add the code.

I’m happy to report that even with these additional tests, the number of failed tests did not increase.

 Posted by on 2019-12-28 at 19:18

The annoying problem of the growing GExperts menu

 Delphi, GExperts  Comments Off on The annoying problem of the growing GExperts menu
Dec 252019
 

As I add new functionality to GExperts the menu it displays grows larger and larger. On small monitors (there are still computers with e.g. 1024×600 pixels screen size in use, usually not with the latest Delphi version though) this means that the menu has to be broken into chunks, each with a “more” entry at the end to display the next chunk.
While this has been implemented for years (decades actually) it didn’t work very well. For Delphi 6 the code was completely broken (I might have been the culprit myself) it still had some bugs with all later versions.

No more. Today I fixed those bugs and tested it with screens as small as 640×480 pixels.

Also, when moving the GExperts menu into the Tools menu, there was a problem that the maximum number of entries for a chunk was not calculated correctly which would mean that the “more” entry could end up outside the visible area. This has also been fixed.

Unfortunately this does not solve the underlying problem: The menu keeps growing. There are now a maximum of 45 + 3 Entries in that menu. The way that menu is created on demand, depending on which experts are enabled or not, does not lend itself to a sensible menu structure.

I have added a “Category” property to each expert, which so far is neither filled nor used anywhere. I plan to create only one entry per Category in the GExperts menu with sub menus for each category. Maybe I will even make those categories configurable. But that’s for another day.

 Posted by on 2019-12-25 at 18:34

Working on the GExperts Code Formatter again

 Delphi, GExperts  Comments Off on Working on the GExperts Code Formatter again
Nov 302019
 

The code formatter can now handle inline variable declarations. That was actually just a simple change (fixes bugs #157 and #158 (and the duplicate #165))

Now I’m trying to get it to format function declarations like this:

function RegisterClipboardFormatW(lpszFormat: PWideChar): UINT; stdcall;
  external user32 Name 'RegisterClipboardFormatW';

or something as simple as this;

procedure bla;
  overload;
  forward;

Currently it doesn’t indent the additional lines. It works fine for method declarations though.

This turns out to be much more complicated than I thought. In my attempts to fix this, I have multiple times broken other test cases. Good thing there’s unit tests and source code management.

By pure chance I found a nasty side effect in the code.

 Posted by on 2019-11-30 at 20:23

GExperts 1.3.15 installers were/are detected as malware

 Delphi, GExperts  Comments Off on GExperts 1.3.15 installers were/are detected as malware
Nov 282019
 

The installers for GExperts 1.3.15 were/are detected as malware by several virus scanners on Virus Total. I have since submitted them all as false positives to Kaspersky and some to Microsoft and after their latest signature updates their scanners are now fine. I tried the same with other virus scanner vendors, but their procedure was so complicated that I decided that it is not worth the effort. So if you are using BitDefender or McAfee, you might be out of luck. Try to submit your installer to them yourself if you like, just so you see how much time that takes. Now multiply that by 19 installers and > 10 virus scanners … I guess you will understand then why I don’t bother.

 Posted by on 2019-11-28 at 17:45

GExperts 1.3.15 experimental twm 2019-11-23 released

 Delphi, GExperts  Comments Off on GExperts 1.3.15 experimental twm 2019-11-23 released
Nov 232019
 

I just released GExperts 1.3.15 for all supported Delphi versions.

There have again been various bug fixes and the following notable changes:

  • There is now a start menu entry for a new stand alone version of the GExperts Code Formatter. Note that it not only has a GUI for selecting a single file to format and show the settings dialog, but can also be called with a list of files to be formatted. So, you could for example drag a group of files onto the executable to format them all. I plan to expand that command line interface in the future to allow formatting all files in a project or in a directory and its subdirectories.
  • Talking about the code formatter: Many more bugs have been fixed. A while ago I was actually thinking I got them all, but unfortunately that turned out to be a delusion. ­čśë
  • The GoTo Line Number dialog enhancer has been removed and replaced with a Go To expert with the same functionality but its own dialog, which has a setting to replace the Search -> Go to Line Number menu entry. If you have any suggestions on further improving that expert, please file a feature request.
  • Bugfix for the PE Information expert: It should now display all exported class names.
  • Many changes to the Uses Clause Manager expert (most of them contributed by Peter Panettone)
    • Bugfixes for the Identifier tab. It wrongly found some identifiers that just weren’t exported from that unit
    • It now highlights any units it will add.
    • It can now parse map files generated by the Win64 compiler, not just those from the Win32 compiler
    • It now shows an error message if it cannot use the map file and resorts to the dpr file.
    • The filter on the Identfier tab now has two modes:
      • Match anywhere
      • Match at start
    • There is now a status bar that shows the full file name of the currently selected unit. A popup menu allows to
      • Copy that file name to the clipboard
      • Copy that file to the clipboard (like pressing Ctrl+C on the file name in the Windows File Explorer)
      • Open the file’s location in the Windows File Explorer
    • The library path for Delphi XE and later was wrong, so the VCL/RTL tab was always empty.
  • There was a bug with the Clipboard History expert: It still hooked the clipboard even if it was disabled. In addition it could kill the IDE when it added new entries to the (possibly invisible) list view. Under some strange conditions setting the text of a memo apparently can fail with an EInvalidOperation exception. This exception was not caught and since it happened deep inside a chain of event handlers, it caused an Access Violation somewhere which then silently killed the IDE. That one was quite difficult to track down.
  • Improvement to the Backup Project expert: A new dialog shows any files it cannot find and it only shows each file once, not every time it does not find it. This was particularly annoying with include files.
  • And last, but not least: The GExperts version for Delphi 10.3 is now compiled with the latest and greatest Delphi 10.3 update 3 release. Let’s hope this fixed some bugs and hasn’t introduced any new ones. (Unfortunately RSP-25645 “Creating sub components with IOTAFormEditor.CreateComponent raises access violation” still hasn’t been fixed, so replacing e.g. TTable with TSqlTable still does not work.)

The new version is available for download on the GExperts download page.

 Posted by on 2019-11-23 at 19:09

No new GExperts release yet for Delphi 10.3.3

 Delphi, GExperts  Comments Off on No new GExperts release yet for Delphi 10.3.3
Nov 212019
 

Edit: There is now a new release.

Before you ask: No, there is no new GExperts release yet for Delphi 10.3.3. I haven’t even downloaded it yet. I might get to it this weekend.

In the meantime you can get the sources and compile your own DLL with the new Delphi version. I don’t expect any problems (but I have been wrong before).

 Posted by on 2019-11-21 at 18:13

If you compiled your own GExperts clear the Uses Clause Manager cache

 Delphi, GExperts  Comments Off on If you compiled your own GExperts clear the Uses Clause Manager cache
Nov 192019
 

This is only relevant, if you have recently compiled your own GExperts DLL and you use the Uses Clause Manager’s Identifier tab:

There were several bugs in the unit parsing code that have been fixed. But you won’t see the effect, because the buggy results from before that have been cached. In order to get the benefit of these bugfixes, you must clear the Uses Clause Manager’s cache.

To do that,

  1. Go to GExperts -> Configuration
  2. On the Experts tab, enter “uses” and press Alt+C
  3. Press the “Clear Cache” button

Yes, I know, that I should make a new release soon, but I keep finding old and sometimes new bugs and then there are people who submit patches. It’s difficult to determine when to make a release. But hey, you have got the source code and the compiler, so why not compile your own DLL?

 Posted by on 2019-11-19 at 17:48

Several bugs regarding the GExperts Uses Clause Manager fixed

 Delphi, GExperts  Comments Off on Several bugs regarding the GExperts Uses Clause Manager fixed
Oct 192019
 

A few months ago I added the “Identifiers” tab to the GExperts Uses Clause Manager. It allows you to search for a unit that exports a given identifier. It works a bit like the “Find Unit” refactoring in the IDE since Delphi 2005.

That feature starts a background thread that parses all units in the search path to get a list of identifiers these units export. It works well with Delphi 2007 but recently I discovered that in Delphi 10.3.2 it finds “FreeAndNil” in various units which I am sure don’t export it:

So something must have been wrong with the parsing code.

It turned out that there were several bugs in that code, all related to language features added to Delphi later than Delphi 2007 (You may remember that I stated several times that I still do most of my work with Delphi 2007 so that version is the one with which GExperts has been tested extensively.).

These bugs have now been fixed and “FreeAndNil” only gets me the expected short list of units:

The changes have been committed to the svn repository (revisions #2807 and #2808), so if you want a DLL without this bug, you can compile your own.

 Posted by on 2019-10-19 at 20:20

All but one known GExperts code formatter bugs fixed

 Delphi, GExperts  Comments Off on All but one known GExperts code formatter bugs fixed
Oct 182019
 

Some long standing bugs in the GExperts code formatter have been fixed.

It’s great to see nearly all unit tests finally succeed.

About 10 new test cases have been added too, so the improvement is significant.

The fixed bugs including some that have bugged (sorry ­čśë ) me for years, e.g.:

  Msg := Format('%s %s'#13#10
    + '%s',
    [a, b
      c]);

where the last line used to be indented the same as the previous line like this:

  Msg := Format('%s %s'#13#10
    + '%s',
    [a, b
    c]);

There is one left:

begin
  { testcomment
}s := '';
end;

where I am not even sure how it should be formatted. Maybe like this:

begin
   { testcomment
   }s := '';
end;

Or maybe it shouldn’t be changed at all.

Anyway, I’m thinking about making another GExperts release this weekend, but haven’t decided yet. If you want a fixed code formatter, you will have to compile your own DLL which isn’t rocket science after all.

 Posted by on 2019-10-18 at 13:55

Yahoo is closing down Groups

 Delphi, GExperts  Comments Off on Yahoo is closing down Groups
Oct 182019
 

I just read that Yahoo will be closing down Groups and will delete all content there.

By the end of October no new content will be accepted, by mid December all content will be deleted.

Why am I posting this? The GExperts mailing lists are hosted at Yahoo Groups, so they will be gone shortly. If you want to stay up to date or communicate with other GExperts users, there is either this blog (there is a GExperts RSS feedWhat is an RSS feed?), or the GExperts sub forum on the international Delphi Praxis forum.

Since Groups was the only remaining Yahoo feature I was using, have also just deleted my Yahoo account.

 Posted by on 2019-10-18 at 10:44