64bit fixes
[AROS-Contrib.git] / vpdf / system / data.h
blob265ace9cc04138f219d28e7dfe9dad6fa978b12f
1 #ifndef DATA_H
2 #define DATA_H
4 #include <stdio.h>
6 typedef struct filenode_t
9 struct filenode_t *next; /* pointer to the next node */
10 struct datahandle_t *data; /* a datafile this file belongs to */
11 char *name; /* comple path */
12 int size; /* */
13 int offset; /* offset in the disk file when the logical file starts */
15 } FileNode;
18 typedef struct datahandle_t
20 struct datahandle_t *next;
21 FILE *sourceFile; /* disk opened file */
22 FileNode *files; /* list of file headers */
24 } DataHandle;
26 /* type of file the filehandle describes */
28 enum
30 FH_ARCHIVE,
31 FH_DISK
34 typedef struct filehandle_t
36 int type; /* FX_xxx */
37 /* for FH_ARCHIVE */
38 DataHandle *data; /* data where the file resists */
39 FileNode *file; /* node describing the file attributes */
41 /* for FH_NORMAL */
43 FILE *diskFile;
45 /* buffering veriables (used mainly with FH_ARCHIVE */
47 int position; /* current file position */
48 char *buffer; /* buffer used for faster reading */
49 int bufferPosition; /* position in the buffer */
50 int bufferSize;
51 int bufferBytes; /* number of bytes in the buffer */
53 } FileHandle;
55 DataHandle *dataOpen(char *fname);
56 void dataClose(DataHandle *data);
57 void dataCloseAll(void);
58 void *dataLoadFile(char *fname);
59 unsigned int dataFileLength(char *fname);
60 FileHandle *dataFileOpen(char *fname);
61 void dataFileClose(FileHandle *handle);
62 void *dataFileGets(FileHandle *handle, void *buf, int len);
63 int dataFileRead(FileHandle *handle, void *buf, int len);
64 void dataExportRequestedFiles(char *fname);
65 void dataStoreRequestedFiles(int enable);
67 #endif