views:

85

answers:

1

I am using DeDe to create an API (Interface) I can compile to. (Strictly legit: while we wait for the vendor to deliver a D2010 version in two months, we can at least get our app compiling...)

We'll stub out all methods.

Dede emits constant declarations like these:

  LTIMGLISTCLASS = 
    00: ÿÿÿÿ....LEADIMGL|FF FF FF FF 0D 00 00 00 4C 45 41 44 49 4D 47 4C|
    10: IST32.          |49 53 54 33 32 00|;

  DS_PREFIX = 
    0: ÿÿÿÿ....DICM.|FF FF FF FF 04 00 00 00 44 49 43 4D 00|;

How would I convert these into a compilable statement?

In theory, I don't care about the actual values, since I doubt they're use anywhere, but I'd like to get their size correct. Are these integers, LongInts or ???

Any other hints on using DeDe would be welcome.

+6  A: 

Those are strings. The first four bytes are the reference count, which for string literals is always -1 ($ffffffff). The next four bytes are the character count. Then comes the characters an a null terminator.

const
  LTIMGLISTCLASS = 'LEADIMGLIST32'; // 13 = $0D characters
  DS_PREFIX = 'DICM'; // 4 = $04 characters

You don't have to "doubt" whether those constants are used anywhere. You can confirm it empirically. Compile your project without those constants. If it compiles, then they're not used.

If your project doesn't compile, then those constants must be used somewhere in your code. Based on the context, you can provide your own declarations. If the constant is used like a string, then declare a string; if it's used like an integer, then declare an integer.

Another option is to load your project in a version of Delphi that's compatible with the DCUs you have. Use code completion to make the IDE display the constant and its type.

Rob Kennedy
As frequently the case, Rob, you're da man! Thanks.And, "Another option is to load your project in a version of Delphi that's compatible with the DCUs you have. Use code completion to make the IDE display the constant and its type." is very creative!! Thanks
Tom1952