Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
unarr-imp.h
Go to the documentation of this file.
1 /* Copyright 2015 the unarr project authors (see AUTHORS file).
2  License: LGPLv3 */
3 
4 /* this is the common private/implementation API of unarr which should only be used by unarr code */
5 
6 #ifndef common_unarr_imp_h
7 #define common_unarr_imp_h
8 
9 #include "../unarr.h"
10 #include "allocator.h"
11 
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <stdarg.h>
15 #include <string.h>
16 #include <inttypes.h>
17 
18 /***** conv ****/
19 
20 size_t ar_conv_rune_to_utf8(wchar_t rune, char *out, size_t size);
21 char *ar_conv_dos_to_utf8(const char *astr);
22 time64_t ar_conv_dosdate_to_filetime(uint32_t dosdate);
23 
24 /***** crc32 *****/
25 
26 uint32_t ar_crc32(uint32_t crc32, const unsigned char *data, size_t data_len);
27 
28 /***** stream *****/
29 
30 typedef void (* ar_stream_close_fn)(void *data);
31 typedef size_t (* ar_stream_read_fn)(void *data, void *buffer, size_t count);
32 typedef bool (* ar_stream_seek_fn)(void *data, off64_t offset, int origin);
33 typedef off64_t (* ar_stream_tell_fn)(void *data);
34 
35 struct ar_stream_s {
40  void *data;
41 };
42 
44 
45 /***** unarr *****/
46 
47 #define warn(...) ar_log("!", __FILE__, __LINE__, __VA_ARGS__)
48 #ifndef NDEBUG
49 #define log(...) ar_log("-", __FILE__, __LINE__, __VA_ARGS__)
50 #else
51 #define log(...) ((void)0)
52 #endif
53 void ar_log(const char *prefix, const char *file, int line, const char *msg, ...);
54 
55 typedef void (* ar_archive_close_fn)(ar_archive *ar);
56 typedef bool (* ar_parse_entry_fn)(ar_archive *ar, off64_t offset);
57 typedef const char *(* ar_entry_get_name_fn)(ar_archive *ar);
58 typedef bool (* ar_entry_uncompress_fn)(ar_archive *ar, void *buffer, size_t count);
59 typedef size_t (* ar_get_global_comment_fn)(ar_archive *ar, void *buffer, size_t count);
60 
61 struct ar_archive_s {
67 
69  bool at_eof;
75 };
76 
77 ar_archive *ar_open_archive(ar_stream *stream, size_t struct_size, ar_archive_close_fn close, ar_parse_entry_fn parse_entry,
79  off64_t first_entry_offset);
80 
81 #endif