views:

652

answers:

2

Hello, 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

+3  A: 

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).

ulrichb
Thank you for your kind reply. I used the Delphi Fundamentals units because I found they are highly optimized. Is there any performance drawback in the new Dictionary<TKey,TValue> approach? I'm going to build a dictionary object with more than 3,00,000 items.Thank you
J K Kunil
I don't know the performance of the different dictionary implementations. But try it out, using simple test procedures and measuring the elapsed time.
ulrichb
+6  A: 

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..

Wouter van Nifterick
Can the downvoter comment on why this was downvoted?
Wouter van Nifterick
I didn't downvote the answer, but I agree it's not helpful. Why use Delphi 2009 at all if the code is castrated to not work with Unicode strings?
mghie
Well, I guess not everybody migrated from D7 to D2006 for inline like I did either. Different people, different reasons. The major highlights are not always the reason.
Marco van de Voort
One good reason is that some other projects need Unicode or other D2009 features, but the one that uses those units don't - I don't like maintaining multiple Delphi installs components' updated, I doubt most people do. I've also heard good things about D2009 stability (although I'm sticking with D2007 for now).
stg
@mghie: the OP didn't state that he needs unicode.. He's looking for a D2009 version of the Fundamentals library, and that's exactly what I provided. It's not castrated, it didn't grow tits; it works like it did in D2007. I cleaned things up, zipped it, uploaded it and shared it here. How is that not helpful? Nowadays the Delphi community is not only too small to be useful, it's starting to stink too. Only a few people contribute, and those who do stop doing it at some point because it's not rewarding to do so, creating a downwards spiral... Yet another nail on Delphi's coffin. :-(
Wouter van Nifterick
You are a lifesaver Wouter van Nifterick. Thank you so much!Yes, I need Unicode in VCL components and classes, but I don't need them in Fundamentals utilities as I'm going to keep my dictionary structure as ANSI, it saves lots of memory when you have lots of items in your dictionary and certain that they will never need Unicode.Thank you again for your contribution and suggestion.BTW, I've also contacted with the author of Delphi fundamentals and he mentioned that he is working on a Delphi 2009 compatible release. Though not sure when it will arrive, it surely will someday.
J K Kunil
The author can probably provide a nice version that supports Unicode, which would be better than this hack. I'll be looking forward to that too.
Wouter van Nifterick