EZDSL: Easy Data Structures Library for Delphi

published: Wed, 18-Jun-2003   |   updated: Sat, 6-Aug-2016

EZDSL is a library of data structures written in Delphi.

I wrote it a long while ago for Delphi 1 as a teaching aid for the (then) new Delphi class model. (It actually grew out of another library I wrote for Borland Pascal 7 called EZSTRUCS. That one I wrote because I'd purchased a pretty awful library that purported to provide standard Pascal data structures written in efficient code. It was bad; it was slow and it even had gotos.) It then served to understand the changes for 32-bit with Delphi 2, and for Linux with Kylix (although I never released those changes).

I've kept it up with the various Delphis, although I'm starting to chafe at the lack of a Delphi for .NET. Maybe, my next adventure is to convert it for C#...


The EZDSL units provide an OOP interface for classical data structures for Delphi: stacks, queues (including deques and priority queues), lists (single, double and skip), hash tables, binary trees (including search and red-black) and so forth.

My objective in writing this implementation was to provide myself with a set of well-encapsulated classes that would manage the tedium of using these types of data structures, leaving me to concentrate on coding my latest program. The data objects stored in EZDSL's containers are typeless pointers, they can be anything that can be typecast to a pointer (eg, integer types), or pointers to record structures, or objects. EZDSL provides a lot of nifty features, things like: sorted containers resorting themselves when the Compare function is changed, clone constructors, data ownership.

You can download the latest version from here. (It's version 3.03, date 14-Feb-2002, size 122,878 bytes.)

Please drop me an e-mail if you are using EZDSL, I'd love to hear from you on how you're using it.

what's going on with ezdsl?

I released version 3.03 on Valentine's Day 2002 (14-Feb-2002). It includes support for Delphi 6 (but not Kylix) and has a much improved boolean array class. For Delphi 7 support, see below.

I used to say at this point in the web page that my next job was to make EZDSL Kylix-aware. Well, not a freaking chance, I'm afraid. I used to have a Mandrake Linux partition on my disk drive, but something went wrong when I tried to install a new display driver and I hosed it. At that point I reformatted the partition for my MP3 collection. One day, I may try again with Linux, but it's going to have to be a lot easier than it was with Mandrake.

Borland have now released Delphi for .NET, a.k.a. Delphi 8. See below for some news on that front.

...and delphi 7?

Adding support for Delphi 7 is easy. Open EZDSLOpt.INC. At the top is a compiler check. Add in Delphi 7's compiler option:

{ Check for Delphi }
    {$IFNDEF VER130} {$IFNDEF VER140} 
      {$IFNDEF VER150}
!! Error - EZDSL is for Delphi 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 or 7.0 *only*

Then, underneath the section for Delphi 6 that looks like this:

{---Delphi 6.0 specific---}
...statements that set options...

add another section that looks the same for Delphi 7:

{---Delphi 7.0 specific---}
{$A+   Use DWORD alignment whereever possible }
{$B-   Short-circuit boolean expressions }
{$I+   I/O checking via exceptions }
{$V-   Disable var string checking }
{$W-   No Windows realmode stack frame }
{$X+   Enable extended syntax }
{$D+,L+  Enable debug information }
{$D-,L-  Disable debug information }

Is EZDSL.NET being worked on?

Call me a fool, call me a visionary, but I started working on a conversion of EZDSL to .NET. After some time doing it, I realized that I was a complete blithering idiot.

I starting off with a Delphi 8 conversion of the code, just because it was originally written in Delphi. I wrote several flogs about what I found along the way (see here) most of which turned out to be rants about why Delphi 8 made it difficult to do what I want. I also wrote an article for The Delphi Magazine in the June 2004 issue on the subject.

To be honest, EZDSL needs to be rewritten completely for the .NET framework. Given the way that Delphi generates namespaces I don't want to have (see one of the above rants) and given some other Delphi wrinkles when used with .NET, I'd be rewriting it in C#.

And that just isn't going to happen. Why? Well, duh, there is already a great set of data containers in the .NET Framework. Also for C# 2.0 (a.k.a. Whidbey), Peter Golde, one of the original developers of the C# compiler, has already written a bloody marvelous collection of containers in PowerCollections. Why reinvent the wheel?

Some more notes:

  • The linked lists won't get converted: using an ArrayList or a TList is a much better and more efficient solution in the general case. In specific cases, a linked list makes sense, but a general class to do linked lists is somewhat overkill: the algorithms are too simple.
  • The priority queue class in EZDSL was written in a primitive style, as an actual binary tree, because it needed to support Delphi 1 with its 64K memory block limit. I've written extensively on how to write priority queues (see here, here, and here, for example), and would need to convert this code to use generics.
  • The Stack and Queue, although easy to convert, have been supplanted by the equivalent classes in System.Collections, and, furthermore, have been written for Delphi 1 and its 64K memory block limit. The official .NET versions are much faster.
  • The hash table has been supplanted by System.Collections.Hashtable in the v1.x Framework, and by Dictionary<K,V> in the v2.0 Framework. I still have to write a better implementation, since the .NET Hashtable uses a brain-dead rehashing algorithm, which could do with being improved.

So, stay tuned. I will release the source code as I complete the various classes.

Support for Delphi 2006 (Win32)

You can download some supplementary files for EZDSL that will enable you to compile it with Delphi 2006 (Win32), and also to produce a package if you need one. The files comprise the required project source and resource files for BDS2006, as well as updated compiler defines and options include files. I am not including pre-compiled packages.

You can get these supplementary files archived as a zip file here. You still have to download the full EZDSL product as well.

(Note that I do not have BDS2005, but it should be fairly easy to do the same for that compiler using these files as a basis.)