OSDN Git Service

contrib:
[pf3gnuchains/gcc-fork.git] / gcc / java / zipfile.h
1 /* Definitions for using a zipped' archive.
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2007
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  
20
21 Java and all Java-based marks are trademarks or registered trademarks
22 of Sun Microsystems, Inc. in the United States and other countries.
23 The Free Software Foundation is independent of Sun Microsystems, Inc.  */
24
25 struct ZipFile {
26   char *name;
27   int fd;
28   long size;
29   long count;
30   long dir_size;
31   char *central_directory;
32
33   /* Chain together in SeenZipFiles. */
34   struct ZipFile *next;
35 };
36
37 typedef struct ZipFile ZipFile;
38
39 struct ZipDirectory {
40   int direntry_size;
41   int filename_offset;
42   int compression_method;
43   unsigned size; /* length of file */
44   unsigned uncompressed_size; /* length of uncompressed data */
45   unsigned filestart;  /* start of file in archive */
46   ZipFile *zipf;
47   int filename_length;
48   /* char mid_padding[...]; */
49   /* char filename[filename_length]; */
50   /* char end_padding[...]; */
51 };
52
53 typedef struct ZipDirectory ZipDirectory;
54
55 extern struct ZipFile *SeenZipFiles;
56
57 #define ZIPDIR_FILENAME(ZIPD) ((char*)(ZIPD)+(ZIPD)->filename_offset)
58 #define ZIPDIR_NEXT(ZIPD) \
59    ((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size))
60 #define ZIPMAGIC 0x504b0304     
61 #define ZIPEMPTYMAGIC 0x504b0506
62
63 extern ZipFile * opendir_in_zip (const char *, int);
64 extern int read_zip_archive (ZipFile *);
65 #ifdef GCC_JCF_H
66 extern int read_zip_member (JCF*, ZipDirectory*, ZipFile *);
67 extern int open_in_zip (struct JCF *, const char *, const char *, int);
68 #endif