Minor refactoring, related to lzah
[deark.git] / src / deark-user.h
blob338572292505e9c11dce5ea3758f767971afd9f7
1 // This file is part of Deark.
2 // Copyright (C) 2016-2018 Jason Summers
3 // See the file COPYING for terms of use.
5 // Definitions used by the command-line utility, and not visible to modules.
7 #ifndef DEARK_H_INC
8 #include "deark.h"
9 #endif
11 deark *de_create(void);
12 void de_destroy(deark *c);
14 void de_register_modules(deark *c);
16 enum de_stdoptions_enum {
17 DE_STDOPT_DEBUG_LEVEL = 1, // 0=off 1=normal 2=verbose 3=more verbose
18 DE_STDOPT_EXTRACT_POLICY, // See DE_EXTRACTPOLICY_ in deark.h
19 DE_STDOPT_EXTRACT_LEVEL, // 1=normal. 2=extract everything
20 DE_STDOPT_LISTMODE,
21 DE_STDOPT_WANT_MODHELP,
22 DE_STDOPT_ID_MODE,
23 DE_STDOPT_WARNINGS,
24 DE_STDOPT_INFOMESSAGES,
25 DE_STDOPT_WRITE_BOM, // When we write a UTF-8 text file, should we start it with a BOM?
26 DE_STDOPT_WRITE_DENSITY,
27 DE_STDOPT_ASCII_HTML, // Use only ASCII in HTML documents.
29 // If a file contains a name that we can use as part of the output filename,
30 // should we use it?
31 DE_STDOPT_FILENAMES_FROM_FILE,
33 // DE_OVERWRITEMODE_DEFAULT = Overwrite, unless the filename is a symlink, in which case fail.
34 // ..._NEVER = Fail if the output file exists (or if the filename is a symlink).
35 // ..._STANDARD = Do whatever fopen() normally does (overwrite, and follow symlinks).
36 DE_STDOPT_OVERWRITE_MODE,
38 DE_STDOPT_PADPIX
41 void de_set_std_option_int(deark *c, enum de_stdoptions_enum o, int x);
43 #define DE_INPUTSTYLE_FILE 0
44 #define DE_INPUTSTYLE_STDIN 1
45 void de_set_input_style(deark *c, int x);
47 void de_set_input_filename(deark *c, const char *fn);
48 int de_set_input_encoding(deark *c, const char *encname, int reserved);
49 void de_set_input_timezone(deark *c, i64 tzoffs_seconds);
50 void de_set_input_file_slice_start(deark *c, i64 n);
51 void de_set_input_file_slice_size(deark *c, i64 n);
53 int de_run(deark *c);
55 void de_print_module_list(deark *c);
57 void de_set_userdata(deark *c, void *x);
58 void *de_get_userdata(deark *c);
60 void de_set_dprefix(deark *c, const char *s);
62 void de_set_first_output_file(deark *c, int x);
63 void de_set_max_output_files(deark *c, i64 n);
64 void de_set_max_output_file_size(deark *c, i64 n);
65 void de_set_max_total_output_size(deark *c, i64 n);
66 void de_set_max_image_dimension(deark *c, i64 n);
68 void de_set_preserve_file_times(deark *c, int setting, int x);
70 void de_set_ext_option(deark *c, const char *name, const char *val);
72 void de_set_messages_callback(deark *c, de_msgfn_type fn);
73 void de_set_special_messages_callback(deark *c, de_specialmsgfn_type fn);
75 // The caller's fatalerror callback is not expected to return.
76 void de_set_fatalerror_callback(deark *c, de_fatalerrorfn_type fn);
78 void de_set_input_format(deark *c, const char *fmtname);
79 void de_set_module_init_codes(deark *c, const char *codes);
81 // See DE_OUTPUTSTYLE_ defs in deark.h
82 void de_set_output_style(deark *c, int x, int subtype);
84 void de_set_output_filename_pattern(deark *c, const char *dirname, const char *fn,
85 unsigned int flags);
86 void de_set_output_special_1st_filename(deark *c, const char *dirname, const char *fn);
88 void de_set_output_archive_filename(deark *c, const char *dirname, const char *fn,
89 unsigned int flags);
91 void de_set_extrlist_filename(deark *c, const char *fn);
93 void de_set_disable_mods(deark *c, const char *s, int invert);
94 void de_set_disable_moddetect(deark *c, const char *s, int invert);
96 struct de_platform_data;
97 struct de_platform_data *de_platformdata_create(void);
98 void de_platformdata_destroy(struct de_platform_data *plctx);
100 #ifdef DE_WINDOWS
101 void de_utf8_to_oem(deark *c, const char *src, char *dst, size_t dstlen);
102 char **de_convert_args_to_utf8(int argc, wchar_t **argvW);
103 void de_free_utf8_args(int argc, char **argv);
104 wchar_t *de_utf8_to_utf16_strdup(deark *c, const char *src);
105 void de_utf8_to_utf16_to_FILE(deark *c, const char *src, FILE *f);
106 void de_winconsole_init_handle(struct de_platform_data *plctx, int n);
107 int de_winconsole_is_console(struct de_platform_data *plctx);
108 void de_winconsole_set_UTF8_CP(struct de_platform_data *plctx);
109 void de_winconsole_record_current_attributes(struct de_platform_data *plctx);
110 void de_winconsole_highlight(struct de_platform_data *plctx, int x);
111 int de_winconsole_try_enable_ansi24(struct de_platform_data *plctx);
112 int de_winconsole_enable_ansi(struct de_platform_data *plctx);
113 #endif