开发者

Convert DeDe constant to valid declaration or other interface extraction tool?

开发者 https://www.devze.com 2023-01-01 17:23 出处:网络
I am using DeDe to create an API (Interfac开发者_开发问答e) 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 compil

I am using DeDe to create an API (Interfac开发者_开发问答e) 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消