メインページ | アルファベット順一覧 | 構成 | ファイル一覧 | 構成メンバ | ファイルメンバ | 関連ページ

# dkcStream.h

説明を見る。

    00001
    00014 #ifndef DKUTIL_C_STREAM_H
    00015 #define DKUTIL_C_STREAM_H
    00016
    00017
    00018 #include "dkcOSIndependent.h"
    00019 #include "dkcMemoryStream.h"
    00020
    00021
    00023 typedef struct dkc_Stream{
    00025     UINT mMode;
    00027     BYTE mChangeEndian;
    00029     BYTE mProcessMode;
    00030     /*union{
    00031         DKC_MEMORYSTREAM *mmem;
    00032         FILE *mfp;
    00033     }uni;*/
    00034     void *mSig;
    00035 }DKC_STREAM;
    00036
    00037 //#error streamのSEEKにRead用とWrite用をつける。
    00038
    00039
    00040 enum edkcStream{
    00042     edkcStreamSeekCurrent = SEEK_CUR,
    00044     edkcStreamSeekEnd = SEEK_END,
    00046     edkcStreamSeekSet = SEEK_SET,
    00048     edkcStreamInitMemory = 1,
    00050     edkcStreamInitFile = 2,
    00052     edkcStreamDefaultEndian = 4,
    00054     edkcStreamBigEndian = 8,
    00056     edkcStreamLittleEndian = 16,
    00058     edkcStreamProcessDefault = 32,
    00060     edkcStreamProcessAsOrdered = 64,
    00064     edkcStreamWriteErrorWhenEndianChange = 128,
    00065
    00068     edkcStreamInitMemoryAdapter = 256,
    00069
    00071     edkcStreamInitFile64 = 512,
    00072
    00073     edkcStreamWin32PromoteFlag = edkcStreamLittleEndian | edkcStreamProcessAsOrdered,
    00074     edkcStreamMacPromoteFlag = edkcStreamBigEndian | edkcStreamProcessAsOrdered,
    00075
    00076 };
    00077
    00078 //**********************************************************
    00079
    00080
    00091
    00092 DKC_EXTERN DKC_STREAM * WINAPI dkcAllocStream(UINT flag,const void *default_data,size_t size,const char *filename,const char *mode);
    00093
    00094 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamMemoryType(UINT flag,const void *default_data,size_t size);
    00095
    00096 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamFileType(UINT flag,const char *filename,const char *mode);
    00100 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamFile64Type(UINT flag,const char *filename,uint32 mode);
    00101
    00107 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamMemoryAdapterType(UINT flag,void *adapt_buffer,size_t size);
    00113
    00114 DKC_EXTERN DKC_STREAM *WINAPI dkcAllocStreamEncouragementFileType(const char *filename,const char *mode,BOOL OrderFlag);
    00115
    00121
    00122 DKC_EXTERN int WINAPI dkcFreeStream(DKC_STREAM **ptr);
    00123
    00124 //**********************************************************
    00126 DKC_EXTERN int WINAPI dkcStreamSeek(DKC_STREAM *ptr,int offset,int origin);
    00127
    00129 DKC_EXTERN long WINAPI dkcStreamTell(DKC_STREAM *ptr);
    00130
    00132 DKC_EXTERN int WINAPI dkcStreamClear(DKC_STREAM *ptr);
    00133
    00134
    00137 DKC_EXTERN int WINAPI dkcStreamFlush(DKC_STREAM *ptr);
    00138
    00140 DKC_EXTERN BOOL WINAPI dkcStreamEOF(DKC_STREAM *ptr);
    00142 DKC_EXTERN BOOL WINAPI dkcStreamError(DKC_STREAM *ptr);
    00143
    00144 //**********************************************************
    00160
    00161 DKC_EXTERN int WINAPI dkcStreamRead(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00162
    00163
    00169 DKC_EXTERN int WINAPI dkcStreamRead8(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00170
    00171
    00179 DKC_EXTERN int WINAPI dkcStreamRead16(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00185 DKC_EXTERN int WINAPI dkcStreamRead32(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00190 DKC_EXTERN int WINAPI dkcStreamRead64(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00191
    00192
    00193 //**********************************************************
    00194
    00196 DKC_EXTERN int WINAPI dkcStreamRef(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00197
    00201 DKC_EXTERN int WINAPI dkcStreamRef8(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00202
    00203 DKC_EXTERN int WINAPI dkcStreamRef16(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00209 DKC_EXTERN int WINAPI dkcStreamRef32(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00214 DKC_EXTERN int WINAPI dkcStreamRef64(DKC_STREAM *ptr,void *buffer,size_t size,size_t *readsize);
    00215
    00216
    00217 //**********************************************************
    00218
    00219
    00226
    00227 DKC_EXTERN int WINAPI dkcStreamWriteWithWriteSize(DKC_STREAM *ptr,const void *buffer,size_t size,size_t *write_size);
    00228
    00229 //DKC_EXTERN int WINAPI dkcStreamWrite(DKC_STREAM *ptr,const void *buffer,size_t size);
    00230
    00231 DKC_INLINE int WINAPI dkcStreamWrite(DKC_STREAM *ptr,const void *buffer,size_t size)
    00232 {
    00233     size_t write_size;
    00234     return dkcStreamWriteWithWriteSize(ptr,buffer,size,&write_size);
    00235     //if(write_size != size)        return edk_FAILED;
    00236 }
    00237
    00238 DKC_EXTERN int WINAPI dkcStreamWrite8(DKC_STREAM *ptr,void *buffer,size_t size);
    00239
    00240 DKC_EXTERN int WINAPI dkcStreamWrite16(DKC_STREAM *ptr,const void *buffer,size_t size);
    00241
    00242 DKC_EXTERN int WINAPI dkcStreamWrite32(DKC_STREAM *ptr,const void *buffer,size_t size);
    00243
    00244 DKC_EXTERN int WINAPI dkcStreamWrite64(DKC_STREAM *ptr,const void *buffer,size_t size);
    00245
    00246
    00247 //**********************************************************
    00248
    00255 typedef int (WINAPI *DKC_STREAM_PROCESS_TYPE)(DKC_STREAM *p,void *buffer,size_t size,void *data);
    00256
    00257
    00258 DKC_EXTERN int WINAPI dkcStreamProcess(DKC_STREAM *ptr,void *buffer,size_t size,
    00259                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00260
    00261 DKC_EXTERN int WINAPI dkcStreamProcess16(DKC_STREAM *ptr,void *buffer,size_t size,
    00262                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00263
    00264 DKC_EXTERN int WINAPI dkcStreamProcess32(DKC_STREAM *ptr,void *buffer,size_t size,
    00265                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00266
    00267 DKC_EXTERN int WINAPI dkcStreamProcess64(DKC_STREAM *ptr,void *buffer,size_t size,
    00268                                                                              DKC_STREAM_PROCESS_TYPE write_t,void *data);
    00269
    00270
    00271
    00272
    00273
    00274
    00275 #endif