Debian Codegraph @

texk/kpathsea/tex-file.h

raw
1 /* tex-file.h: find files in a particular format.
2
3 Copyright 1993, 1994, 1995, 1996, 2007, 2008, 2009, 2010, 2013,
4 2014-2024 Karl Berry.
5 Copyright 1998-2005 Olaf Weber.
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 This library 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 GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this library; if not, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef KPATHSEA_TEX_FILE_H
21 #define KPATHSEA_TEX_FILE_H
22
23 #include <kpathsea/c-proto.h>
24 #include <stdarg.h>
25 #include <kpathsea/types.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #ifdef MAKE_KPSE_DLL /* libkpathsea internal only */
32
33 /* This initializes the fallback resolution list. If ENVVAR
34 is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if
35 that's not set either, a compile-time default is used. */
36 extern void kpathsea_init_fallback_resolutions (kpathsea kpse, string envvar);
37
38 #endif /* MAKE_KPSE_DLL */
39
40 /* If LEVEL is >= FMT's `program_enable_level', set `program_enabled_p'
41 for FMT to VALUE. */
42 extern KPSEDLL void kpathsea_set_program_enabled (kpathsea kpse,
43 kpse_file_format_type fmt, boolean value, kpse_src_type level);
44
45 /* Call kpse_set_program_enabled with VALUE and the format corresponding
46 to FMTNAME. */
47 extern KPSEDLL void kpathsea_maketex_option (kpathsea kpse,
48 const_string fmtname, boolean value);
49
50 /* Change the list of searched suffixes for FORMAT to ... (alternate
51 suffixes if ALTERNATE is true). */
52 extern KPSEDLL void kpathsea_set_suffixes (kpathsea kpse,
53 kpse_file_format_type format, boolean alternate, ...);
54
55 /* Initialize the info for the given format, returning the final search
56 path. This is called automatically by `kpse_find_file', but the
57 glyph searching (for example) can't use that function, so it
58 must also be available separately. */
59 extern KPSEDLL const_string kpathsea_init_format (kpathsea kpse,
60 kpse_file_format_type format);
61
62 /* Like kpathsea_init_format, but return the list of (environment/config)
63 variable names considered, which is not otherwise saved. This is
64 only used by kpsewhich --help. */
65 extern KPSEDLL const_string kpathsea_init_format_return_varlist (kpathsea kpse,
66 kpse_file_format_type format);
67
68 /* If FORMAT has a non-null `suffix' member, append it to NAME "."
69 and call `kpse_path_search' with the result and the other arguments.
70 If that fails, try just NAME. */
71 extern KPSEDLL string kpathsea_find_file (kpathsea kpse, const_string name,
72 kpse_file_format_type format, boolean must_exist);
73
74 /* Ditto, allowing ALL parameter and hence returning a NULL-terminated
75 list of results. */
76 extern KPSEDLL string *kpathsea_find_file_generic (kpathsea kpse,
77 const_string name, kpse_file_format_type format, boolean must_exist,
78 boolean all);
79
80 /* Return true if FNAME is acceptable to open for reading or writing.
81 If not acceptable, write a message to stderr. */
82 extern KPSEDLL boolean kpathsea_in_name_ok (kpathsea kpse, const_string fname);
83 extern KPSEDLL boolean kpathsea_out_name_ok(kpathsea kpse, const_string fname);
84
85 /* As above, but no error message. */
86 extern KPSEDLL boolean kpathsea_in_name_ok_silent
87 (kpathsea kpse, const_string fname);
88 extern KPSEDLL boolean kpathsea_out_name_ok_silent
89 (kpathsea kpse, const_string fname);
90
91 /* Four more name-checking routines, this time with the "extended"
92 parameter set, which also checks TEXMF[SYS]VAR (see the Kpathsea manual).
93 Hopefully we won't need to add yet more options . */
94 extern KPSEDLL boolean kpathsea_in_name_ok_extended (kpathsea, const_string);
95 extern KPSEDLL boolean kpathsea_out_name_ok_extended (kpathsea, const_string);
96 extern KPSEDLL boolean kpathsea_in_name_ok_silent_extended
97 (kpathsea kpse, const_string fname);
98 extern KPSEDLL boolean kpathsea_out_name_ok_silent_extended
99 (kpathsea kpse, const_string fname);
100
101 /* Don't just look up a name, actually open a file. The name_ok
102 functions are not called, this just does the file opening. */
103 extern KPSEDLL FILE *kpathsea_open_file (kpathsea kpse, const_string name,
104 kpse_file_format_type format);
105
106 /* This function is used to set kpse_program_name (from progname.c) to
107 a different value. It will clear the path searching information, to
108 ensure that the search paths are appropriate to the new name. */
109 extern KPSEDLL void kpathsea_reset_program_name (kpathsea kpse,
110 const_string progname);
111
112
113 #if defined (KPSE_COMPAT_API)
114
115 /* Abbreviations without the initial kpathsea argument. */
116 extern void kpse_init_fallback_resolutions (string envvar);
117
118 extern KPSEDLL void kpse_set_program_enabled (kpse_file_format_type fmt,
119 boolean value, kpse_src_type level);
120
121 extern KPSEDLL void kpse_maketex_option (const_string fmtname, boolean value);
122
123 extern KPSEDLL void kpse_set_suffixes (kpse_file_format_type format,
124 boolean alternate, ...);
125
126 extern KPSEDLL const_string kpse_init_format (kpse_file_format_type);
127
128 extern KPSEDLL string kpse_find_file (const_string name,
129 kpse_file_format_type format, boolean must_exist);
130
131 extern KPSEDLL string *kpse_find_file_generic
132 (const_string name, kpse_file_format_type format,
133 boolean must_exist, boolean all);
134
135 extern KPSEDLL boolean kpse_in_name_ok (const_string fname);
136 extern KPSEDLL boolean kpse_out_name_ok (const_string fname);
137
138 extern KPSEDLL boolean kpse_in_name_ok_silent (const_string fname);
139 extern KPSEDLL boolean kpse_out_name_ok_silent (const_string fname);
140
141 extern KPSEDLL boolean kpse_in_name_ok_extended (const_string fname);
142 extern KPSEDLL boolean kpse_out_name_ok_extended (const_string fname);
143
144 extern KPSEDLL boolean kpse_in_name_ok_silent_extended (const_string fname);
145 extern KPSEDLL boolean kpse_out_name_ok_silent_extended (const_string fname);
146
147 /* Here are some abbreviations. */
148 #define kpse_find_mf(name) kpse_find_file (name, kpse_mf_format, true)
149 #define kpse_find_mft(name) kpse_find_file (name, kpse_mft_format, true)
150 #define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true)
151 #define kpse_find_tex(name) kpse_find_file (name, kpse_tex_format, true)
152 #define kpse_find_tfm(name) kpse_find_file (name, kpse_tfm_format, true)
153 #define kpse_find_ofm(name) kpse_find_file (name, kpse_ofm_format, true)
154
155 /* The `false' is correct for DVI translators, which should clearly not
156 require vf files for every font (e.g., cmr10.vf). But it's wrong for
157 VF translators, such as vftovp. */
158 #define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false)
159 #define kpse_find_ovf(name) kpse_find_file (name, kpse_ovf_format, false)
160
161 extern KPSEDLL FILE *kpse_open_file (const_string, kpse_file_format_type);
162
163 extern KPSEDLL void kpse_reset_program_name (const_string progname);
164 #endif
165
166 #ifdef __cplusplus
167 }
168 #endif
169
170 #endif /* not KPATHSEA_TEX_FILE_H */