beta-0.89.2
[luatex.git] / source / texk / kpathsea / tex-file.h
blob1796bc63093b86c6937599b3498b89f7bceccc29
1 /* tex-file.h: find files in a particular format.
3 Copyright 1993, 1994, 1995, 1996, 2007, 2008, 2009, 2010, 2013,
4 2014 Karl Berry.
5 Copyright 1998-2005 Olaf Weber.
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.
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.
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/>. */
20 #ifndef KPATHSEA_TEX_FILE_H
21 #define KPATHSEA_TEX_FILE_H
23 #include <kpathsea/c-proto.h>
24 #include <stdarg.h>
25 #include <kpathsea/types.h>
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
31 #ifdef MAKE_KPSE_DLL /* libkpathsea internal only */
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);
38 #endif /* MAKE_KPSE_DLL */
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);
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);
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, ...);
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);
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);
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);
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);
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);
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);
91 /* Don't just look up the name, actually open the file. */
92 extern KPSEDLL FILE *kpathsea_open_file (kpathsea kpse, const_string name,
93 kpse_file_format_type format);
95 /* This function is used to set kpse_program_name (from progname.c) to
96 a different value. It will clear the path searching information, to
97 ensure that the search paths are appropriate to the new name. */
98 extern KPSEDLL void kpathsea_reset_program_name (kpathsea kpse,
99 const_string progname);
102 #if defined (KPSE_COMPAT_API)
104 extern void kpse_init_fallback_resolutions (string envvar);
106 extern KPSEDLL void kpse_set_program_enabled (kpse_file_format_type fmt,
107 boolean value, kpse_src_type level);
109 extern KPSEDLL void kpse_maketex_option (const_string fmtname, boolean value);
111 extern KPSEDLL void kpse_set_suffixes (kpse_file_format_type format,
112 boolean alternate, ...);
114 extern KPSEDLL const_string kpse_init_format (kpse_file_format_type);
116 extern KPSEDLL string kpse_find_file (const_string name,
117 kpse_file_format_type format, boolean must_exist);
119 extern KPSEDLL string *kpse_find_file_generic
120 (const_string name, kpse_file_format_type format,
121 boolean must_exist, boolean all);
123 extern KPSEDLL boolean kpse_in_name_ok (const_string fname);
124 extern KPSEDLL boolean kpse_out_name_ok (const_string fname);
126 /* Here are some abbreviations. */
127 #define kpse_find_mf(name) kpse_find_file (name, kpse_mf_format, true)
128 #define kpse_find_mft(name) kpse_find_file (name, kpse_mft_format, true)
129 #define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true)
130 #define kpse_find_tex(name) kpse_find_file (name, kpse_tex_format, true)
131 #define kpse_find_tfm(name) kpse_find_file (name, kpse_tfm_format, true)
132 #define kpse_find_ofm(name) kpse_find_file (name, kpse_ofm_format, true)
134 /* The `false' is correct for DVI translators, which should clearly not
135 require vf files for every font (e.g., cmr10.vf). But it's wrong for
136 VF translators, such as vftovp. */
137 #define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false)
138 #define kpse_find_ovf(name) kpse_find_file (name, kpse_ovf_format, false)
140 extern KPSEDLL FILE *kpse_open_file (const_string, kpse_file_format_type);
142 extern KPSEDLL void kpse_reset_program_name (const_string progname);
143 #endif
145 #ifdef __cplusplus
147 #endif
149 #endif /* not KPATHSEA_TEX_FILE_H */