2999
|
1 /* tex-file.h: find files in a particular format. |
|
2 |
|
3 Copyright (C) 1993, 94, 95, 96 Karl Berry. |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public |
|
16 License along with this library; if not, write to the Free Software |
|
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
18 |
|
19 #ifndef KPATHSEA_TEX_FILE_H |
|
20 #define KPATHSEA_TEX_FILE_H |
|
21 |
|
22 #include <kpathsea/c-proto.h> |
|
23 #include <kpathsea/types.h> |
|
24 |
|
25 |
|
26 /* If non-NULL, try looking for this if can't find the real font. */ |
|
27 extern const_string kpse_fallback_font; |
|
28 |
|
29 |
|
30 /* If non-NULL, default list of fallback resolutions comes from this |
|
31 instead of the compile-time value. Set by dvipsk for the R config |
|
32 cmd. *SIZES environment variables override/use as default. */ |
|
33 extern DllImport const_string kpse_fallback_resolutions_string; |
|
34 |
|
35 /* If non-NULL, check these if can't find (within a few percent of) the |
|
36 given resolution. List must end with a zero element. */ |
|
37 extern unsigned *kpse_fallback_resolutions; |
|
38 |
|
39 /* This initializes the fallback resolution list. If ENVVAR |
|
40 is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if |
|
41 that's not set either, a compile-time default is used. */ |
|
42 extern void kpse_init_fallback_resolutions P1H(string envvar); |
|
43 |
|
44 /* We put the glyphs first so we don't waste space in an array in |
|
45 tex-glyph.c. Accompany a new format here with appropriate changes in |
|
46 tex-file.c and kpsewhich.c (the suffix variable). */ |
|
47 typedef enum |
|
48 { |
|
49 kpse_gf_format, |
|
50 kpse_pk_format, |
|
51 kpse_any_glyph_format, /* ``any'' meaning anything above */ |
3172
|
52 kpse_tfm_format, |
2999
|
53 kpse_afm_format, |
|
54 kpse_base_format, |
|
55 kpse_bib_format, |
|
56 kpse_bst_format, |
|
57 kpse_cnf_format, |
|
58 kpse_db_format, |
|
59 kpse_fmt_format, |
|
60 kpse_fontmap_format, |
|
61 kpse_mem_format, |
|
62 kpse_mf_format, |
|
63 kpse_mfpool_format, |
|
64 kpse_mft_format, |
|
65 kpse_mp_format, |
|
66 kpse_mppool_format, |
|
67 kpse_mpsupport_format, |
|
68 kpse_ocp_format, |
|
69 kpse_ofm_format, |
|
70 kpse_opl_format, |
|
71 kpse_otp_format, |
|
72 kpse_ovf_format, |
|
73 kpse_ovp_format, |
|
74 kpse_pict_format, |
|
75 kpse_tex_format, |
|
76 kpse_texdoc_format, |
|
77 kpse_texpool_format, |
|
78 kpse_texsource_format, |
|
79 kpse_tex_ps_header_format, |
|
80 kpse_troff_font_format, |
|
81 kpse_type1_format, |
|
82 kpse_vf_format, |
|
83 kpse_dvips_config_format, |
|
84 kpse_ist_format, |
3172
|
85 kpse_truetype_format, |
|
86 kpse_type42_format, |
|
87 kpse_web2c_format, |
|
88 kpse_program_text_format, |
|
89 kpse_program_binary_format, |
2999
|
90 kpse_last_format /* one past last index */ |
|
91 } kpse_file_format_type; |
|
92 |
|
93 |
|
94 /* Perhaps we could use this for path values themselves; for now, we use |
|
95 it only for the program_enabled_p value. */ |
|
96 typedef enum |
|
97 { |
|
98 kpse_src_implicit, /* C initialization to zero */ |
|
99 kpse_src_compile, /* configure/compile-time default */ |
|
100 kpse_src_texmf_cnf, /* texmf.cnf, the kpathsea config file */ |
|
101 kpse_src_client_cnf, /* application config file, e.g., config.ps */ |
|
102 kpse_src_env, /* environment variable */ |
|
103 kpse_src_x, /* X Window System resource */ |
3172
|
104 kpse_src_cmdline /* command-line option */ |
2999
|
105 } kpse_src_type; |
|
106 |
|
107 |
|
108 /* For each file format, we record the following information. The main |
|
109 thing that is not part of this structure is the environment variable |
|
110 lists. They are used directly in tex-file.c. We could incorporate |
|
111 them here, but it would complicate the code a bit. We could also do |
|
112 it via variable expansion, but not now, maybe not ever: |
|
113 ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}. */ |
|
114 |
|
115 typedef struct |
|
116 { |
|
117 const_string type; /* Human-readable description. */ |
|
118 const_string path; /* The search path to use. */ |
|
119 const_string raw_path; /* Pre-$~ (but post-default) expansion. */ |
|
120 const_string path_source; /* Where the path started from. */ |
|
121 const_string override_path; /* From client environment variable. */ |
|
122 const_string client_path; /* E.g., from dvips's config.ps. */ |
|
123 const_string cnf_path; /* From texmf.cnf. */ |
|
124 const_string default_path; /* If all else fails. */ |
3172
|
125 const_string *suffix; /* For kpse_find_file to check for/append. */ |
2999
|
126 const_string *alt_suffix; /* More suffixes to check for. */ |
|
127 boolean suffix_search_only; /* Only search with a suffix? */ |
3172
|
128 const_string program; /* ``mktexpk'', etc. */ |
2999
|
129 const_string program_args; /* Args to `program'. */ |
|
130 boolean program_enabled_p; /* Invoke `program'? */ |
|
131 kpse_src_type program_enable_level; /* Who said to invoke `program'. */ |
3172
|
132 boolean binmode; /* The files must be opened in binary mode. */ |
2999
|
133 } kpse_format_info_type; |
|
134 |
|
135 /* The sole variable of that type, indexed by `kpse_file_format_type'. |
|
136 Initialized by calls to `kpse_find_file' for `kpse_init_format'. */ |
|
137 extern DllImport kpse_format_info_type kpse_format_info[]; |
|
138 |
|
139 |
|
140 /* If LEVEL is higher than `program_enabled_level' for FMT, set |
|
141 `program_enabled_p' to VALUE. */ |
|
142 extern void kpse_set_program_enabled P3H(kpse_file_format_type fmt, |
|
143 boolean value, kpse_src_type level); |
|
144 /* Call kpse_set_program_enabled with VALUE and the format corresponding |
|
145 to FMTNAME. */ |
|
146 extern void kpse_maketex_option P2H(const_string fmtname, boolean value); |
|
147 |
|
148 /* Initialize the info for the given format. This is called |
|
149 automatically by `kpse_find_file', but the glyph searching (for |
|
150 example) can't use that function, so make it available. */ |
|
151 extern const_string kpse_init_format P1H(kpse_file_format_type); |
|
152 |
|
153 /* If FORMAT has a non-null `suffix' member, append it to NAME "." |
|
154 and call `kpse_path_search' with the result and the other arguments. |
|
155 If that fails, try just NAME. */ |
|
156 extern string kpse_find_file P3H(const_string name, |
|
157 kpse_file_format_type format, boolean must_exist); |
|
158 |
|
159 /* Here are some abbreviations. */ |
|
160 #define kpse_find_mf(name) kpse_find_file (name, kpse_mf_format, true) |
|
161 #define kpse_find_mft(name) kpse_find_file (name, kpse_mft_format, true) |
|
162 #define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true) |
|
163 #define kpse_find_tex(name) kpse_find_file (name, kpse_tex_format, true) |
|
164 #define kpse_find_tfm(name) kpse_find_file (name, kpse_tfm_format, true) |
3172
|
165 #define kpse_find_ofm(name) kpse_find_file (name, kpse_ofm_format, true) |
2999
|
166 |
|
167 /* The `false' is correct for DVI translators, which should clearly not |
|
168 require vf files for every font (e.g., cmr10.vf). But it's wrong for |
|
169 VF translators, such as vftovp. */ |
|
170 #define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false) |
3172
|
171 #define kpse_find_ovf(name) kpse_find_file (name, kpse_ovf_format, false) |
2999
|
172 |
|
173 /* Don't just look up the name, actually open the file. */ |
|
174 extern FILE *kpse_open_file P2H(const_string, kpse_file_format_type); |
|
175 |
3172
|
176 /* This function is used to set kpse_program_name (from progname.c) to |
|
177 a different value. It will clear the path searching information, to |
|
178 ensure that the search paths are appropriate to the new name. */ |
|
179 |
|
180 extern void kpse_reset_program_name P1H(const_string progname); |
|
181 |
2999
|
182 #endif /* not KPATHSEA_TEX_FILE_H */ |