00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ADIKT_MEMFILE_H
00022 #define ADIKT_MEMFILE_H
00023
00024 #include "globals.h"
00025
00030 #define MAX_FILE_SIZE 734003200
00031
00032
00033 #define MFILE_OK 0
00034 #define MFILE_CANNOT_OPEN -17
00035 #define MFILE_MALLOC_ERR -18
00036 #define MFILE_SIZE_ERR -19
00037 #define MFILE_READ_ERR -20
00038 #define MFILE_INTERNAL -21
00039
00040 struct MEMORY_FILE
00041 {
00042 unsigned long len;
00043 unsigned long alloc_len;
00044 unsigned long alloc_delta;
00045 unsigned long pos;
00046 unsigned char *content;
00047 short errcode;
00048 };
00049
00050 DLLIMPORT short memfile_new(struct MEMORY_FILE **mfile, unsigned long alloc_len);
00051 DLLIMPORT short memfile_free(struct MEMORY_FILE **mfile);
00052 DLLIMPORT unsigned char *memfile_leave_content(struct MEMORY_FILE **mfile);
00053 DLLIMPORT short memfile_read(struct MEMORY_FILE *mfile,const char *fname,unsigned long max_size);
00054 DLLIMPORT short memfile_readnew(struct MEMORY_FILE **mfile,const char *fname,unsigned long max_size);
00055 DLLIMPORT short memfile_add(struct MEMORY_FILE *mfile,
00056 const unsigned char *buf,unsigned long buf_len);
00057 DLLIMPORT short memfile_set(struct MEMORY_FILE *mfile,
00058 unsigned char *buf,unsigned long len,unsigned long alloc_len);
00059 DLLIMPORT short memfile_growalloc(struct MEMORY_FILE *mfile, unsigned long alloc_len);
00060 DLLIMPORT char *memfile_error(int errcode);
00061
00062
00063
00064
00065 #endif // ADIKT_MEMFILE_H