source: OGRE/trunk/ogre_dependencies/Dependencies/include/zzip/mmapped.h @ 692

Revision 692, 3.2 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1#ifndef _ZZIP_MMAPPED_H_
2#define _ZZIP_MMAPPED_H_
3/*
4 * simplified zip disk access using a mmapping of the whole archive.
5 *
6 * Author:
7 *      Guido Draheim <guidod@gmx.de>
8 *
9 * Copyright (c) 2003,2004 Guido Draheim
10 *          All rights reserved,
11 *          use under the restrictions of the
12 *          Lesser GNU General Public License
13 *          or alternatively the restrictions
14 *          of the Mozilla Public License 1.1
15 */
16
17
18#include <zzip/types.h>
19
20typedef struct zzip_disk_file  ZZIP_DISK_FILE;
21typedef struct zzip_disk       ZZIP_DISK;
22typedef struct zzip_disk_entry ZZIP_DISK_ENTRY;
23
24/* we expose this structure so third party applications can augment
25 * on them. The mmapped zip access usually just needs the two pointers
26 * specifying the mmapped area, whereever you have that from.
27 */
28struct zzip_disk
29{
30    char* buffer;      /* start of mmapped area, the base of all seekvals */
31    char* endbuf;      /* end of mmapped area, i.e. buffer + buflen */
32    char* reserved;    /* - for later extensions (might be renamed) */
33    char* user;        /* - free for applications (use this!) */
34    long  flags;       /* bit 0: findfile searches case-insensitive */
35    long  mapped;      /* used for mmap() wrappers of zzip/__mmap.h */
36    long  unused;      /* - for later extensions (might be renamed) */
37    long  code;        /* - free for applications (use this!) */
38};
39
40typedef int (*zzip_strcmp_fn_t)(char*, char*);
41typedef int (*zzip_fnmatch_fn_t)(char*, char*, int);
42
43#define zzip_disk_extern extern
44
45zzip_disk_extern int
46zzip_disk_init(ZZIP_DISK* disk, char* buffer, zzip_size_t buflen);
47
48zzip_disk_extern ZZIP_DISK* _zzip_restrict
49zzip_disk_new(void);
50
51zzip_disk_extern ZZIP_DISK* _zzip_restrict
52zzip_disk_mmap(int fd);
53
54zzip_disk_extern int
55zzip_disk_munmap(ZZIP_DISK* disk);
56
57zzip_disk_extern ZZIP_DISK*  _zzip_restrict
58zzip_disk_open(char* filename);
59
60zzip_disk_extern int
61zzip_disk_close(ZZIP_DISK* disk);
62
63
64zzip_disk_extern int
65zzip_disk_init (ZZIP_DISK* disk, char* buffer, _zzip_size_t buflen);
66
67zzip_disk_extern ZZIP_DISK_ENTRY*
68zzip_disk_findfirst(ZZIP_DISK* disk);
69
70zzip_disk_extern ZZIP_DISK_ENTRY*
71zzip_disk_findnext(ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry);
72
73char* _zzip_restrict
74zzip_disk_entry_strdup_name(ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry);
75struct zzip_file_header*
76zzip_disk_entry_to_file_header(ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry);
77char*
78zzip_disk_entry_to_data(ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry);
79
80zzip_disk_extern ZZIP_DISK_ENTRY*
81zzip_disk_findfile(ZZIP_DISK* disk,
82                   char* filename, ZZIP_DISK_ENTRY* after,
83                   zzip_strcmp_fn_t compare);
84zzip_disk_extern ZZIP_DISK_ENTRY*
85zzip_disk_findmatch(ZZIP_DISK* disk,
86                    char* filespec, ZZIP_DISK_ENTRY* after,
87                    zzip_fnmatch_fn_t compare, int flags);
88
89
90zzip_disk_extern ZZIP_DISK_FILE* _zzip_restrict
91zzip_disk_entry_fopen (ZZIP_DISK* disk, ZZIP_DISK_ENTRY* entry);
92
93zzip_disk_extern ZZIP_DISK_FILE* _zzip_restrict
94zzip_disk_fopen (ZZIP_DISK* disk, char* filename);
95
96zzip_disk_extern _zzip_size_t
97zzip_disk_fread (void* ptr, _zzip_size_t size, _zzip_size_t nmemb,
98                 ZZIP_DISK_FILE* file);
99zzip_disk_extern int
100zzip_disk_fclose (ZZIP_DISK_FILE* file);
101int
102zzip_disk_feof (ZZIP_DISK_FILE* file);
103
104#endif
105
Note: See TracBrowser for help on using the repository browser.