CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/GeneratorInterface/ReggeGribovPartonMCInterface/src/7zFile.h

Go to the documentation of this file.
00001 /* 7zFile.h -- File IO
00002 2009-11-24 : Igor Pavlov : Public domain */
00003 
00004 #ifndef __7Z_FILE_H
00005 #define __7Z_FILE_H
00006 
00007 #ifdef _WIN32
00008 #define USE_WINDOWS_FILE
00009 #endif
00010 
00011 #ifdef USE_WINDOWS_FILE
00012 #include <windows.h>
00013 #else
00014 #include <stdio.h>
00015 #endif
00016 
00017 #include "Types.h"
00018 
00019 EXTERN_C_BEGIN
00020 
00021 /* ---------- File ---------- */
00022 
00023 typedef struct
00024 {
00025   #ifdef USE_WINDOWS_FILE
00026   HANDLE handle;
00027   #else
00028   FILE *file;
00029   #endif
00030 } CSzFile;
00031 
00032 void File_Construct(CSzFile *p);
00033 #if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
00034 WRes InFile_Open(CSzFile *p, const char *name);
00035 WRes OutFile_Open(CSzFile *p, const char *name);
00036 #endif
00037 #ifdef USE_WINDOWS_FILE
00038 WRes InFile_OpenW(CSzFile *p, const WCHAR *name);
00039 WRes OutFile_OpenW(CSzFile *p, const WCHAR *name);
00040 #endif
00041 WRes File_Close(CSzFile *p);
00042 
00043 /* reads max(*size, remain file's size) bytes */
00044 WRes File_Read(CSzFile *p, void *data, size_t *size);
00045 
00046 /* writes *size bytes */
00047 WRes File_Write(CSzFile *p, const void *data, size_t *size);
00048 
00049 WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin);
00050 WRes File_GetLength(CSzFile *p, UInt64 *length);
00051 
00052 
00053 /* ---------- FileInStream ---------- */
00054 
00055 typedef struct
00056 {
00057   ISeqInStream s;
00058   CSzFile file;
00059 } CFileSeqInStream;
00060 
00061 void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
00062 
00063 
00064 typedef struct
00065 {
00066   ISeekInStream s;
00067   CSzFile file;
00068 } CFileInStream;
00069 
00070 void FileInStream_CreateVTable(CFileInStream *p);
00071 
00072 
00073 typedef struct
00074 {
00075   ISeqOutStream s;
00076   CSzFile file;
00077 } CFileOutStream;
00078 
00079 void FileOutStream_CreateVTable(CFileOutStream *p);
00080 
00081 EXTERN_C_END
00082 
00083 #endif