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

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

There is one left:

  { testcomment
}s := '';

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

   { testcomment
   }s := '';

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

dzBdsLauncher 1.0.1 released

 Delphi, dzBdsLauncher  Comments Off on dzBdsLauncher 1.0.1 released
Oct 142019

dzBdsLauncher tries to solve the problem of accidentally opening a Delphi project with the wrong Delphi version. The latest version 1.0.1 now also reads the .DPROJ file to determine the Delphi version. See the dzBdsLauncher page for details.

 Posted by on 2019-10-14 at 17:20

Code Template examples saved from Code Central oblivion

 Delphi  Comments Off on Code Template examples saved from Code Central oblivion
Oct 102019

As I mentioned before, Embarcadero will turn off Code Central which will result in a wealth of Delphi code and tools vanishing from the face of the earth.

I have just saved two more entries for posterity:

  • Code Template Script examples [Archive.org]

    Code Template example for seeding a live template point with the clipboard contents. Also an example that modifies the ‘var’ code template allowing for initialization of the variable being declared.

    There are 2 templates included. A replacement for the var template and a new template called clippy that takes what is on the clipboard and surrounds it with a try…finally block.

    download link and

  • Code Template Basics – NewBucketList [archive.is]

    Code Template for Creating Code Template Basics – Delphi2006 by Adam Markowitz. NewBucketList code template is used as the example.

    download link

both by Adam Markowitz a former Borland Employee.

The Delphi Wiki has some more live templates.

 Posted by on 2019-10-10 at 16:39

TCsvWriter added to dzlib

 Delphi, dzLib  Comments Off on TCsvWriter added to dzlib
Oct 102019

Yes, I know, there are many already existing solutions for writing a CSV file in Delphi. And some are probably better than mine (for general purpose usage), but those I looked at had too many shortcomings for my particular use case, so I wrote my own. (There might also have been some not invented here syndrome involved.)

Anyway: It’s now in my dzlib as u_dzCsvWriter and there are also unit tests for it.

Note that I have tested it only with Delphi 2007 so far (because I needed it for Delphi 2007). There might be Unicode related bugs that only surface in later versions.

 Posted by on 2019-10-10 at 11:50

Digging in Archive.org: StringList value class

 Delphi  Comments Off on Digging in Archive.org: StringList value class
Oct 042019

I was just prompted to dig into archive.org to find an ancient (2008) blog post by Alan Bauer A “Nullable” Post which I used back then to implement the nullable types in dzlib.

A comment there mentioned this post on code central (archived). It’s about a StringList value class which frees you of the additional code necessary for creating and freeing a TStringList, so you can e.g. have a function that returns one without leaking memory. Interesting stuff by Janez Makovsek (who back then worked for Dew Research, no idea if he is still there)

StringList is the same as TStringList except that it is a value
type. It does not have to be created, destroyed or put within
try/finally. This is done by the compiler for you. There are
virtually no special performance penalties for these to work:

  strings: StringList;
  astr: string;
  aStr := string(strings);

The code can be used as a template to wrap any TObject as a value class type.

Since Code Central is going to vanish from the face of the earth shortly, I have downloaded that ZIP file so it will be available for posterity.

 Posted by on 2019-10-04 at 16:47

GExperts 1.3.14 experimental twm 2019-09-08 released

 Delphi, GExperts  Comments Off on GExperts 1.3.14 experimental twm 2019-09-08 released
Sep 082019

I just released GExperts 1.3.14 for all supported Delphi versions.

Apart from the bug fixes to the source code formatter there are the following changes:

  • Export and Import entries for the Tools menu (blog post)
  • Copy and paste for Delphi Tool menu entries (blog post)
  • The Uses Clause Manager builds its list of identifiers in the background so it should now take less than a second to display the identifier list.
  • Since Delphi XE3 and later no longer allow creating components with subcomponents (the OTAPI function for that crashes – bug report here), GExperts no longer supports these components in the Replace Components expert.
  • The Delphi Tool Properties dialog now gets resized so the list of macros can be displayed without scrolling.
  • Added incremental search to Code Proofreader dictionary
  • Keep StringGrid selection visible when focusing other controls in the Rename Components configuration dialog. (Patch by Achim Kalwa)
  • Fix for bug #129 The “Other Properties” list in the Rename Components Configuration is not saved if the list is empty. (Patch by Achim Kalwa)
  • New “Focus Code Editor” expert, provides a keyboard shortcut Shift+F6 to focus the code editor window.
  • Improved output in the Keyvoard Shortcuts window: Modifier keys are shown in a separate column. The list can be sorted by clicking on the title column.
  • Workaround for bug #127: Open File now always sets the focus to the code editor when a file was opened.
  • Separate configuration dialog for printing in class browser moved to a new tab in the standard configuration dialog
  • Moved the “Parse map file” option to the main search dialog of Grep
  • Fix for bug #124: Error while installing multiple design packages
  • Partial bugfix for Grep search in form files (bug #120): If multiline search is *not* active, no matches are found. Not sure this fixes the problem that is originally reported in #120 since I was never able to reproduce the problem.
  • Also add a size grip to the GExperts configuration dialog (Patch by Achim Kalwa)
  • Unfold source at found position for Previous / Next identifier editor expert
  • Unfold source when jumping to code editor from procedure list
  • More flexible Convert Strings expert
  • Lots of small improvements to the code base that are not visible to the user.

Please note that the naming scheme has changed. The files are now called GX<DelphiVersion>_<GExpertsVersion>_experimental_twm_<date>.exe. where the GExperts version is now fully spelled out as 1.3.14 rather than 1.3E.

There is also one change that some of you might not like:
I was getting lots of emails containing feature requests and bug reports that were sent via the bug report / feature request dialog in GExperts. Since I usually don’t have the time to immediately attend to them they tend to accumulate in my inbox and clutter it until I find the time to wade through them and usually create a feature request or bug report on SourceForge. This process is not only time consuming but also error prone.

I prefer to work on the actual program rather than being my own secretary. So, from now on the the dialog mentioned above links to the appropriate page on SourceForge instead.

Yes, that means I expect my users who want some bug to be fixed or a feature added to invest the effort to:

  • Create an account on SourceForge if they don’t have one.
  • Write a detailed bug report / feature request, including screen shots if that’s helpful.
  • Answer any questions that might arise from these reports via SourceForge.

If you don’t like this, think about your attitude. You are getting this tool for free after all and nobody forces you to use it. (Yes, I have received some rather disturbing emails when I asked people to file a bug report on SourceForge instead of sending them to me or posting them in some forums. Please remember: I don’t get paid for my work on GExperts, you are not my customers, therefore I don’t need to be “service minded” as somebody called it.)

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

 Posted by on 2019-09-08 at 14:23

Various bugs in the GExperts code formatter fixed

 Delphi, GExperts  Comments Off on Various bugs in the GExperts code formatter fixed
Sep 082019

There were some long standing bugs in the GExperts code formatter, most of them concerning language features that didn’t exist back in Delphi 2007 (and therefore were not my primary concern for a long time). I have fixed several of them now:

  • Anonymous methods were not indented correctly
  • Various problems with Generics as reported here and some more I found myself while testing the ones reported

In addition there are the bugs I already fixed last weekend:

  • Variant records with methods were not indented correctly
  • The formatter did not know the ‘final’ keyword

I’m pretty sure that the quality of the GExperts code formatter now exceeds the one of the built in formatter in the Delphi IDE (which in my eyes only recently became actually usable, the first versions were just bug ridden proofs of concept). That of course doesn’t mean that it is perfect now. If you find any more bugs, please report them! I cannot fix bugs that I am not aware of and there are still a lot of language features that I don’t or rarely use myself. Please include examples of wrongly and correctly formatted code with these reports (as actual text, not as a bitmap).

 Posted by on 2019-09-08 at 11:44