--- /dev/null
+#ifndef __UNZIP_H\r
+#define __UNZIP_H\r
+\r
+#include <stdio.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+// notaz: something's missing this\r
+#ifndef UINT16\r
+#define UINT32 unsigned int\r
+#define UINT16 unsigned short\r
+#define UINT8 unsigned char\r
+#endif\r
+\r
+/***************************************************************************\r
+ * Support for retrieving files from zipfiles\r
+ ***************************************************************************/\r
+\r
+struct zipent {\r
+ UINT32 cent_file_header_sig;\r
+ UINT8 version_made_by;\r
+ UINT8 host_os;\r
+ UINT8 version_needed_to_extract;\r
+ UINT8 os_needed_to_extract;\r
+ UINT16 general_purpose_bit_flag;\r
+ UINT16 compression_method;\r
+ UINT16 last_mod_file_time;\r
+ UINT16 last_mod_file_date;\r
+ UINT32 crc32;\r
+ UINT32 compressed_size;\r
+ UINT32 uncompressed_size;\r
+ UINT16 filename_length;\r
+ UINT16 extra_field_length;\r
+ UINT16 file_comment_length;\r
+ UINT16 disk_number_start;\r
+ UINT16 internal_file_attrib;\r
+ UINT32 external_file_attrib;\r
+ UINT32 offset_lcl_hdr_frm_frst_disk;\r
+ char* name; /* 0 terminated */\r
+};\r
+\r
+typedef struct _ZIP {\r
+ char* zip; /* zip name */\r
+ FILE* fp; /* zip handler */\r
+ long length; /* length of zip file */\r
+\r
+ char* ecd; /* end_of_cent_dir data */\r
+ unsigned ecd_length; /* end_of_cent_dir length */\r
+\r
+ char* cd; /* cent_dir data */\r
+\r
+ unsigned cd_pos; /* position in cent_dir */\r
+\r
+ struct zipent ent; /* buffer for readzip */\r
+\r
+ /* end_of_cent_dir */\r
+ UINT32 end_of_cent_dir_sig;\r
+ UINT16 number_of_this_disk;\r
+ UINT16 number_of_disk_start_cent_dir;\r
+ UINT16 total_entries_cent_dir_this_disk;\r
+ UINT16 total_entries_cent_dir;\r
+ UINT32 size_of_cent_dir;\r
+ UINT32 offset_to_start_of_cent_dir;\r
+ UINT16 zipfile_comment_length;\r
+ char* zipfile_comment; /* pointer in ecd */\r
+} ZIP;\r
+\r
+/* Opens a zip stream for reading\r
+ return:\r
+ !=0 success, zip stream\r
+ ==0 error\r
+*/\r
+ZIP* openzip(const char* path);\r
+\r
+/* Closes a zip stream */\r
+void closezip(ZIP* zip);\r
+\r
+/* Reads the current entry from a zip stream\r
+ in:\r
+ zip opened zip\r
+ return:\r
+ !=0 success\r
+ ==0 error\r
+*/\r
+struct zipent* readzip(ZIP* zip);\r
+\r
+/* Suspend access to a zip file (release file handler)\r
+ in:\r
+ zip opened zip\r
+ note:\r
+ A suspended zip is automatically reopened at first call of\r
+ readuncompressd() or readcompressed() functions\r
+*/\r
+void suspendzip(ZIP* zip);\r
+\r
+/* Resets a zip stream to the first entry\r
+ in:\r
+ zip opened zip\r
+ note:\r
+ ZIP file must be opened and not suspended\r
+*/\r
+void rewindzip(ZIP* zip);\r
+\r
+/* Read compressed data from a zip entry\r
+ in:\r
+ zip opened zip\r
+ ent entry to read\r
+ out:\r
+ data buffer for data, ent.compressed_size UINT8s allocated by the caller\r
+ return:\r
+ ==0 success\r
+ <0 error\r
+*/\r
+int readcompresszip(ZIP* zip, struct zipent* ent, char* data);\r
+\r
+/* Read decompressed data from a zip entry\r
+ in:\r
+ zip zip stream open\r
+ ent entry to read\r
+ out:\r
+ data buffer for data, ent.uncompressed_size UINT8s allocated by the caller\r
+ return:\r
+ ==0 success\r
+ <0 error\r
+*/\r
+int readuncompresszip(ZIP* zip, struct zipent* ent, char* data);\r
+\r
+/* public functions */\r
+int /* error */ load_zipped_file (const char *zipfile, const char *filename,\r
+ unsigned char **buf, unsigned int *length);\r
+int /* error */ checksum_zipped_file (const char *zipfile, const char *filename, unsigned int *length, unsigned int *sum);\r
+\r
+void unzip_cache_clear(void);\r
+\r
+/* public globals */\r
+extern int gUnzipQuiet; /* flag controls error messages */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif\r