views:

139

answers:

4

i am confuse on how to translate this code: to delphi?

char    **szWords;                            // recognized words
char    ***szPhones;                          // recognized phones per word
float   *pScorePron;                          // pronunciation score
float   **pScorePronPhone;                    // pronunciation score of phones
float   *pScoreAcc;                           // accent score
float   *pScoreInto;                          // intonation score
float   *pScoreDur;                           // duration score
float   *pScoreTot;                           // total evaluation score
char    szEvaluResultTxt[MAX_STR_LEN];        // evaluation text result
int     nWordNum;                             // number of recognized words
int     *pPhoneNum;                           // number of recognized phones per word

if you know good site on how to transtalte C++ to Delphi vise versa. please suggest. thanx in advans

+1  A: 

You might save yourself from a world of pain by using Dr. Bob's Header Conversion utility.

In a nutshell

HeadConv has full support for functions and procedures, argument and return types (128 custom type conversions) and generates implicit Delphi import units. The expert is integrated in the Delphi IDE, making the conversion very easy as the converted file is opened up in the IDE automatically. At this time there is limited (non-complex) support for typedefs, structs, unions, enums and conditional compilations. HeadConv is not targeted to do the conversion 100% on its own, rather it will assist in converting the C DLL header files!

Lieven
its kinda old. there are errors. but any way, it could help on some other code.
XBasic3000
It's not because it's old it doesn't work. Have you tried it? Does it convert 90% leaving you with 10% to do manually? Vice versa?
Lieven
in my case, it gives me 5 persent good. they are the hint. maybe because my lirary are so complicated. just like have variable of "char ***szPhones;" i know char * is a PChar, but what is the tristar stand for?
XBasic3000
A pointer to a pointer to a PChar I assume?!
Lieven
but how could i write it?
XBasic3000
You could take a look here http://stackoverflow.com/questions/758673/uses-for-multiple-levels-of-pointer-dereferences for examples on its use and here http://stackoverflow.com/questions/3780636/what-is-the-delphi-equivalent-of-unsigned-char-in-c
Lieven
+5  A: 

A good article to start with would be Pitfalls of converting by Rudy Velthuis.

Jens Mühlenhoff
+1  A: 

I suggest you to download JEDI API Library and Microsoft Windows SDK (its headers only), from them you can learn a lot of tips and tricks of C header conversion.

There is no perfect C header conversion tool. Therefore, I found Rudy's Conversion Helper Package helped me a lot.

Vantomex
+1  A: 

it looks like

char    ***szPhones;

is a dynamic 3 dimensional array, used to store a list of words, with a list of phones associated with each word. so in delphi this would be.

var szPhones : array of array of array of char;
MikeT