1 /* tex-file.h: find files in a particular format.
3 Copyright 1993, 1994, 1995, 1996, 2007 Karl Berry.
4 Copyright 1998-2005 Olaf Weber.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef KPATHSEA_TEX_FILE_H
23 #define KPATHSEA_TEX_FILE_H
25 #include <kpathsea/c-proto.h>
26 #include <kpathsea/c-vararg.h>
27 #include <kpathsea/types.h>
30 /* If non-NULL, try looking for this if can't find the real font. */
31 extern const_string kpse_fallback_font;
34 /* If non-NULL, default list of fallback resolutions comes from this
35 instead of the compile-time value. Set by dvipsk for the R config
36 cmd. *SIZES environment variables override/use as default. */
37 extern KPSEDLL const_string kpse_fallback_resolutions_string;
39 /* If non-NULL, check these if can't find (within a few percent of) the
40 given resolution. List must end with a zero element. */
41 extern unsigned *kpse_fallback_resolutions;
43 /* This initializes the fallback resolution list. If ENVVAR
44 is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if
45 that's not set either, a compile-time default is used. */
46 extern void kpse_init_fallback_resolutions P1H(string envvar);
48 /* We put the glyphs first so we don't waste space in an array in
49 tex-glyph.c. Accompany a new format here with appropriate changes in
50 tex-file.c and kpsewhich.c (the suffix variable). */
55 kpse_any_glyph_format, /* ``any'' meaning gf or pk */
71 kpse_mpsupport_format,
82 kpse_texsource_format,
83 kpse_tex_ps_header_format,
84 kpse_troff_font_format,
87 kpse_dvips_config_format,
92 kpse_program_text_format,
93 kpse_program_binary_format,
94 kpse_miscfonts_format,
100 kpse_opentype_format,
101 kpse_pdftex_config_format,
103 kpse_texmfscripts_format,
105 kpse_last_format /* one past last index */
106 } kpse_file_format_type;
109 /* Perhaps we could use this for path values themselves; for now, we use
110 it only for the program_enabled_p value. */
113 kpse_src_implicit, /* C initialization to zero */
114 kpse_src_compile, /* configure/compile-time default */
115 kpse_src_texmf_cnf, /* texmf.cnf, the kpathsea config file */
116 kpse_src_client_cnf, /* application config file, e.g., config.ps */
117 kpse_src_env, /* environment variable */
118 kpse_src_x, /* X Window System resource */
119 kpse_src_cmdline /* command-line option */
123 /* For each file format, we record the following information. The main
124 thing that is not part of this structure is the environment variable
125 lists. They are used directly in tex-file.c. We could incorporate
126 them here, but it would complicate the code a bit. We could also do
127 it via variable expansion, but not now, maybe not ever:
128 ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}. */
132 const_string type; /* Human-readable description. */
133 const_string path; /* The search path to use. */
134 const_string raw_path; /* Pre-$~ (but post-default) expansion. */
135 const_string path_source; /* Where the path started from. */
136 const_string override_path; /* From client environment variable. */
137 const_string client_path; /* E.g., from dvips's config.ps. */
138 const_string cnf_path; /* From texmf.cnf. */
139 const_string default_path; /* If all else fails. */
140 const_string *suffix; /* For kpse_find_file to check for/append. */
141 const_string *alt_suffix; /* More suffixes to check for. */
142 boolean suffix_search_only; /* Only search with a suffix? */
143 const_string program; /* ``mktexpk'', etc. */
144 int argc; /* Count of standard arguments. */
145 const_string *argv; /* Standard arguments to `program'. */
146 boolean program_enabled_p; /* Invoke `program'? */
147 kpse_src_type program_enable_level; /* Who said to invoke `program'. */
148 boolean binmode; /* The files must be opened in binary mode. */
149 } kpse_format_info_type;
151 /* The sole variable of that type, indexed by `kpse_file_format_type'.
152 Initialized by calls to `kpse_find_file' for `kpse_init_format'. */
153 extern KPSEDLL kpse_format_info_type kpse_format_info[kpse_last_format];
156 /* If LEVEL is higher than `program_enabled_level' for FMT, set
157 `program_enabled_p' to VALUE. */
158 extern KPSEDLL void kpse_set_program_enabled P3H(kpse_file_format_type fmt,
159 boolean value, kpse_src_type level);
160 /* Call kpse_set_program_enabled with VALUE and the format corresponding
162 extern KPSEDLL void kpse_maketex_option P2H(const_string fmtname, boolean value);
164 /* Change the list of searched suffixes (alternate suffixes if alternate is
166 extern KPSEDLL void kpse_set_suffixes PVAR2H(kpse_file_format_type format,
169 /* Initialize the info for the given format. This is called
170 automatically by `kpse_find_file', but the glyph searching (for
171 example) can't use that function, so make it available. */
172 extern KPSEDLL const_string kpse_init_format P1H(kpse_file_format_type);
174 /* If FORMAT has a non-null `suffix' member, append it to NAME "."
175 and call `kpse_path_search' with the result and the other arguments.
176 If that fails, try just NAME. */
177 extern KPSEDLL string kpse_find_file P3H(const_string name,
178 kpse_file_format_type format, boolean must_exist);
180 /* Ditto, allowing ALL parameter and hence returning a NULL-terminated
182 extern KPSEDLL string *kpse_find_file_generic
183 P4H(const_string name, kpse_file_format_type format,
184 boolean must_exist, boolean all);
186 /* Here are some abbreviations. */
187 #define kpse_find_mf(name) kpse_find_file (name, kpse_mf_format, true)
188 #define kpse_find_mft(name) kpse_find_file (name, kpse_mft_format, true)
189 #define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true)
190 #define kpse_find_tex(name) kpse_find_file (name, kpse_tex_format, true)
191 #define kpse_find_tfm(name) kpse_find_file (name, kpse_tfm_format, true)
192 #define kpse_find_ofm(name) kpse_find_file (name, kpse_ofm_format, true)
194 /* The `false' is correct for DVI translators, which should clearly not
195 require vf files for every font (e.g., cmr10.vf). But it's wrong for
196 VF translators, such as vftovp. */
197 #define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false)
198 #define kpse_find_ovf(name) kpse_find_file (name, kpse_ovf_format, false)
200 /* Don't just look up the name, actually open the file. */
201 extern KPSEDLL FILE *kpse_open_file P2H(const_string, kpse_file_format_type);
203 /* This function is used to set kpse_program_name (from progname.c) to
204 a different value. It will clear the path searching information, to
205 ensure that the search paths are appropriate to the new name. */
206 extern KPSEDLL void kpse_reset_program_name P1H(const_string progname);
208 #endif /* not KPATHSEA_TEX_FILE_H */