请翻译c to delphi急(100分)

  • 主题发起人 主题发起人 dongliu
  • 开始时间 开始时间
D

dongliu

Unregistered / Unconfirmed
GUEST, unregistred user!
#ifndef __PDFAPI_H__
#define __PDFAPI_H__
#include "machine.h" /* defines basic data types and sizes */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define generic types used throughout API
*/
typedef uint16 CW;
/* data type capable of holding a single codeword */
typedef uint8 BUFDATA;
/* input/output basic unit */
#if (ENVTYPE &
PDF_E_WINMASK) != 0 /* Win16/32 system */
/*
* For windows environments, we know we have already included the
* windows.h header file so we have all definitions we already need. We
* just map the windows definitions to ours
*/
typedef LONG FILEPOS;
/* file position indicator */
# if (ENVTYPE == PDF_E_WIN32)
typedef HANDLE FILEHANDLE;
typedef HANDLE GENHANDLE;
# else
typedef HFILE FILEHANDLE;
typedef HANDLE GENHANDLE;
# endif
#else
/*do
S/other environments */
typedef int FILEHANDLE;
/* open file handle for O/S */
typedef long FILEPOS;
/* file position indicator */
typedef int16 GENHANDLE;
#endif
/*
Pointer definitions:
LP - full-size address specification prefix
C - constant data prefix
LPC - full-size address specification to constant data
*/
typedef char FAR *LPSTRING;
typedef const char FAR *LPCSTRING;
/* non-changing string */
typedef BUFDATA FAR *LPBUF;
/* source data buffer type */
typedef const BUFDATA FAR *LPCBUF;
typedef void FAR *LPVOID;
/* generic buffer pointer */
typedef const void FAR *LPCVOID;
typedef uint32 FAR *LPUINT32;
typedef uint16 FAR *LPUINT16;
typedef CW FAR *LPCW;
/* symbol codeword buffer pointer */
typedef const CW FAR *LPCCW;
typedef uint32 PDFSIZET, FAR *LPPDFSIZET;
typedef BUFDATA FAR *LPMEMBUF;
typedef int16 PDFSTATUS;
typedef PDFSIZET PDFCALLBACK FNPDFIO( int16 nCmd, LPBUF lpBufIO, uint16 nBytes, LPVOID lpGeneric );
typedef FNPDFIO FAR *LPFNPDFIO;
typedef struct s_pdfobject {
uint16 ioType;
/* Input/Output */
uint16 ioDirection;
/* File/Callback/Memory */
PDFSIZET nLen;
/* (Bytes to encode)/(Bytes written) */
union {
LPMEMBUF lpMemBuffer;
struct {
LPFNPDFIO lpfnCallback;
LPVOID lpAppArg;
} func;
struct {
FILEHANDLE hFile;
FILEPOS nInitPos;
Bool fMustClose;
} file;
struct {
LPMEMBUF lpMem;
/* For CF_TEXT clipboard input */
uint16 fmtOutput;
/* API definition for output format */
} clip;
} access;
Bool fIsHuge;
LPVOID lpState;
/* internal state information/buffer */
} PDFObject;
typedef PDFObject FAR *LPPDFObject;
 
// 可以放到练功场里的说,:)
头晕
还有个machine.h中的东西影响我们的翻译哪!
 
有一个叫HEADCONV.EXE的程序可以实现
 
看了就头痛,你这是想转换数据结构,PDF文件......?我不是不能,而是一看到
C的这种结构我就想睡觉。
 
这是machine.h
# define ENVTYPE PDF_E_WIN32
# define LIBTYPE PDF_L_STATIC
# ifndef PDFAPI
# define PDFAPI __stdcall
# endif
# define PDFCALLBACK __stdcall
#elif defined(_WINDOWS) || defined(_Windows)
# include <windows.h>
# define ENVTYPE PDF_E_WIN16
# ifndef PDFAPI
# define PDFAPI _far _pascal
# endif
# define PDFCALLBACK _far _pascal _export
#elif defined(_MSDOS)
# define ENVTYPE PDF_E_DOS
# define LIBTYPE PDF_L_STATIC
# define PDFAPI _far _pascal
# define PDFCALLBACK _far _pascal
# define FAR _far
#elif defined(_FLAT)
# define ENVTYPE PDF_E_FLAT
# define LIBTYPE PDF_L_STATIC
# define PDFAPI
# define PDFCALLBACK
# define FAR
#endif
#if (ENVTYPE == PDF_E_WIN16) || (ENVTYPE == PDF_E_DOS)
# define HUGE_PTRS
#else
# undef HUGE_PTRS
#endif
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned long uint32;
typedef signed char int8;
typedef short int16;
typedef long int32;
typedef unsigned char uchar;
typedef int Bool;

#endif
 
to yanghaijun:
求人一命,胜于睡觉.谢谢!!
 
高手注意:只要翻译正确,分数可以再加,再加300怎么样?
 
unit Unit1;
interface
{$IFNDEF __PDFAPI_H__}
{$DEFINE __PDFAPI_H__}
uses machine;
{$ENDIF}
type
CW = Word;
BUFDATA = Byte;
{$IF ENVTYPE and PDF_E_WINMASK}
FILEPOS = Long;
{$IF ENVTYPE = PDF_E_WIN32}
FILEHANDLE = Word;
GENHANDLE = Word;
{$else
}
FILEHANDLE = HFILE;
GENHANDLE = Word;
{$ENDIF}
{$else
}
FILEHANDLE = ShortInt;
FILEPOS = Long;
GENHANDLE = SmallInt;
{$ENDIF}
LPSTRING = PChar;
LPCSTRING = PChar;
LPBUF = ^BUFDATA;
LPVOID = Pointer;
LPCVOID = Pointer;
LPUINT32 = Cardinal;
LPUINT16 = Word;
LPCW = ^CW;
LPCCW = ^CW;
PDFSIZET = Cardinal;
LPPDFSIZET = Pointer;
LPMEMBUF = ^BUFDATA;
PDFSTATUS = SmallInt;
LPNPDFIO = function (nCmd: SmallInt;
lpBufIO: LPBUF;
nBytes: Word;
lpGeneric: LPVOID): PDFSIZET;
PDFObject = record
ioType : Word;
ioDirection : Word;
nLen : PDFSIZET;
Case Integer of
0: (lpfnCallback : LPFNPDFIO;
lpAppArg : LPVOID;
fIsHuge : Boolean;
lpState : LPVOID);
1: (hFile : FILEHANDLE;
nInitPos : FILEPOS;
fMustClose : WordBool;
fIsHuge : Boolean;
lpState : LPVOID);
2: (lpMem : LPMEMBUF;
fmtOutput : Word;
NotUsed : Word;
fIsHuge : Boolean;
lpState : LPVOID);
end;
LPPDFObject = ^PDFObject;
implementation
end.
 
接受答案了.
 
后退
顶部