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