这段C语言代码如何转换为pascal语言。 (50分)

L

lxmzm

Unregistered / Unconfirmed
GUEST, unregistred user!
#ifndef GAIN_ANALYSIS_H
#define GAIN_ANALYSIS_H
#include <stddef.h>
#define GAIN_NOT_ENOUGH_SAMPLES -24601
#define GAIN_ANALYSIS_ERROR 0
#define GAIN_ANALYSIS_OK 1
#define INIT_GAIN_ANALYSIS_ERROR 0
#define INIT_GAIN_ANALYSIS_OK 1
#ifdef __cplusplus
extern "C" {
#endif
typedefdo
uble Float_t;
// Type used for filtering
int InitGainAnalysis ( long samplefreq );
int AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels );
int ResetSampleFrequency ( long samplefreq );
Float_t GetTitleGain ( void );
Float_t GetAlbumGain ( void );
#ifdef __cplusplus
}
#endif
#endif
 
Y

yzhshi

Unregistered / Unconfirmed
GUEST, unregistred user!
尝试翻译了一下,关键是看你这个帖子的ID不错1333333。呵呵。
有不对的地方,给你注释上了,你自己填上吧。
unit Unit2;
interface
uses Windows;

const
GAIN_NOT_ENOUGH_SAMPLES = -24601;
GAIN_ANALYSIS_ERROR = 0;
GAIN_ANALYSIS_OK = 1;
INIT_GAIN_ANALYSIS_ERROR = 0;
INIT_GAIN_ANALYSIS_OK = 1;
GAIN_ANALYSIS = 'GAIN_ANALYSIS.dll';
//这个是你的动态库的DLL的名称
type
Float_t =do
uble;
LPFloat_t =do
uble;
//这个的等效定义不知道,暂时使用Double代替
size_t = Integer;
//这个的等效定义不知道,暂时使用Integer代替
function InitGainAnalysis(samplefreq: LongInt): Integer;
stdcall;
function AnalyzeSamples(const left_samples: LPFloat_t;
const right_samples: LPFloat_t;
num_samples: size_t;
num_channels: Integer): Integer;
stdcall;
function ResetSampleFrequency(samplefreq: LongInt): Integer;
stdcall;
function GetTitleGain: Float_t;
stdcall;
function GetAlbumGain: Float_t;
stdcall;

implementation
function InitGainAnalysis;
external GAIN_ANALYSIS name 'InitGainAnalysis';
function AnalyzeSamples;
external GAIN_ANALYSIS name 'AnalyzeSamples';
function ResetSampleFrequency;
external GAIN_ANALYSIS name 'ResetSampleFrequency';
function GetTitleGain;
external GAIN_ANALYSIS name 'GetTitleGain';
function GetAlbumGain;
external GAIN_ANALYSIS name 'GetAlbumGain';
end.
 
L

lxmzm

Unregistered / Unconfirmed
GUEST, unregistred user!
这种又如何翻译呢?
typedef struct
{
char vendor[9];
char prodId[17];
char rev[5];
char vendSpec[21];
} CDINFO, *PCDINFO, FAR *LPCDINFO;
typedef struct
{
BYTE ha;
BYTE tgt;
BYTE lun;
BYTE pad;
char id[MAXIDLEN + 1];
CDINFO info;
} CDREC, *PCDREC, FAR *LPCDREC;
 
Y

yzhshi

Unregistered / Unconfirmed
GUEST, unregistred user!
这个?
PCDINFO = ^CDINFO;
LPCDINFO = ^CDINFO;
CDINFO = record
vendor : array[0..8] of char;
prodId : array[0..16] of char;
rev : array[0..4] of char;
vendSpec : array[0..20] of char;
end;

PCDREC = ^CDREC;
LPCDREC = ^CDREC;
CDREC = record
ha : BYTE;
tgt : BYTE;
lun : BYTE;
pad : BYTE;
id : array[0..MAXIDLEN] of char;
info : CDINFO;
end;
 
C

coldease

Unregistered / Unconfirmed
GUEST, unregistred user!
to :yzhshi
看来你 是高手哦 !
 
L

lxmzm

Unregistered / Unconfirmed
GUEST, unregistred user!
多人接受答案了。
 
顶部