1 /* types.h: general types for kpathsea.
3 Copyright 1993, 1995, 1996, 2005, 2008-2014 Karl Berry.
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this library; if not, see <http://www.gnu.org/licenses/>. */
18 #ifndef KPATHSEA_TYPES_H
19 #define KPATHSEA_TYPES_H
21 /* Our string, boolean, etc. */
22 #include <kpathsea/simpletypes.h>
24 /* Required until all programs use the new API, if ever. */
25 #define KPSE_COMPAT_API 1
27 #include <stdio.h> /* for FILE* */
29 /* Declare int64_t and uint64_t, and define PRId64 etc. */
30 #ifdef HAVE_INTTYPES_H
31 # include <inttypes.h>
36 #if (!defined __cplusplus || defined __STDC_FORMAT_MACROS) && !defined PRId64
38 # define __PRI64_PREFIX "l"
40 # define __PRI64_PREFIX "ll"
42 # define PRId64 __PRI64_PREFIX "d"
43 # define PRIi64 __PRI64_PREFIX "i"
44 # define PRIo64 __PRI64_PREFIX "o"
45 # define PRIu64 __PRI64_PREFIX "u"
46 # define PRIx64 __PRI64_PREFIX "x"
47 # define PRIX64 __PRI64_PREFIX "X"
54 /* function pointer prototype definitions for recorder */
55 typedef void (*p_record_input
) (const_string
);
56 typedef void (*p_record_output
) (const_string
);
62 /* the cache structure from elt-dirs.c */
63 #include <kpathsea/str-llist.h>
72 str_llist_type
*value
;
86 #include <kpathsea/hash.h>
87 #include <kpathsea/str-list.h>
93 /* from old tex-file.h */
95 /* We put the glyphs first so we don't waste space in an array in
96 tex-glyph.c. Accompany a new format here with appropriate changes in
97 tex-file.c and kpsewhich.c (the suffix variable). */
102 kpse_any_glyph_format
, /* ``any'' meaning gf or pk */
118 kpse_mpsupport_format
,
129 kpse_texsource_format
,
130 kpse_tex_ps_header_format
,
131 kpse_troff_font_format
,
134 kpse_dvips_config_format
,
136 kpse_truetype_format
,
139 kpse_program_text_format
,
140 kpse_program_binary_format
,
141 kpse_miscfonts_format
,
147 kpse_opentype_format
,
148 kpse_pdftex_config_format
,
150 kpse_texmfscripts_format
,
159 kpse_last_format
/* one past last index */
160 } kpse_file_format_type
;
163 /* Perhaps we could use this for path values themselves; for now, we use
164 it only for the program_enabled_p value. */
167 kpse_src_implicit
, /* C initialization to zero */
168 kpse_src_compile
, /* configure/compile-time default */
169 kpse_src_texmf_cnf
, /* texmf.cnf, the kpathsea config file */
170 kpse_src_client_cnf
, /* application config file, e.g., config.ps */
171 kpse_src_env
, /* environment variable */
172 kpse_src_x
, /* X Window System resource */
173 kpse_src_cmdline
/* command-line option */
177 /* For each file format, we record the following information. The main
178 thing that is not part of this structure is the environment variable
179 lists. They are used directly in tex-file.c. We could incorporate
180 them here, but it would complicate the code a bit. We could also do
181 it via variable expansion, but not now, maybe not ever:
182 ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}. */
186 const_string type
; /* Human-readable description. */
187 string path
; /* The search path to use. */
188 const_string raw_path
; /* Pre-$~ (but post-default) expansion. */
189 const_string path_source
; /* Where the path started from. */
190 const_string override_path
; /* From client environment variable. */
191 const_string client_path
; /* E.g., from dvips's config.ps. */
192 const_string cnf_path
; /* From texmf.cnf. */
193 const_string default_path
; /* If all else fails. */
194 const_string
*suffix
; /* For kpse_find_file to check for/append. */
195 const_string
*alt_suffix
; /* More suffixes to check for. */
196 boolean suffix_search_only
; /* Only search with a suffix? */
197 const_string program
; /* ``mktexpk'', etc. */
198 int argc
; /* Count of standard arguments. */
199 const_string
*argv
; /* Standard arguments to `program'. */
200 boolean program_enabled_p
; /* Invoke `program'? */
201 kpse_src_type program_enable_level
; /* Who said to invoke `program'. */
202 boolean binmode
; /* Open files in binary mode? */
203 } kpse_format_info_type
;
205 #if defined(WIN32) && !defined(__MINGW32__)
216 #endif /* WIN32 && !__MINGW32 */
218 typedef struct kpathsea_instance
*kpathsea
;
220 typedef struct kpathsea_instance
{
222 p_record_input record_input
; /* for --recorder */
223 p_record_output record_output
; /* for --recorder */
224 hash_table_type cnf_hash
; /* used by read_all_cnf */
225 boolean doing_cnf_init
; /* for kpse_cnf_get */
227 hash_table_type db
; /* The hash table for all ls-R's */
228 hash_table_type alias_db
; /* The hash table for the aliases */
229 str_list_type db_dir_list
; /* list of ls-R's */
231 unsigned debug
; /* for --kpathsea-debug */
233 hash_table_type link_table
; /* a hash of links-per-dir */
235 cache_entry
*the_cache
;
236 unsigned cache_length
;
238 hash_table_type map
; /* the font mapping hash */
239 const_string map_path
; /* path for kpse_fontmap_format */
241 /* Print the hash values as integers if this is nonzero. */
242 boolean debug_hash_lookup_int
;
243 /* from path-elt.c */
244 string elt
; /* static buffer for return value */
246 const_string path
; /* path we're currently working on */
247 /* from pathsearch.c */
248 boolean followup_search
;
250 boolean log_opened
; /* Need to open the log file? */
251 /* from progname.c */
252 string invocation_name
;
253 string invocation_short_name
;
254 string program_name
; /* pretended name */
255 int ll_verbose
; /* for symlinks (conditional) */
256 /* from tex-file.c */
257 /* If non-NULL, try looking for this if can't find the real font. */
258 const_string fallback_font
;
259 /* If non-NULL, default list of fallback resolutions comes from this
260 instead of the compile-time value. Set by dvipsk for the R config
261 cmd. *SIZES environment variables override/use as default. */
262 const_string fallback_resolutions_string
;
263 /* If non-NULL, check these if can't find (within a few percent of) the
264 given resolution. List must end with a zero element. */
265 unsigned *fallback_resolutions
;
266 kpse_format_info_type format_info
[kpse_last_format
];
267 /* from tex-make.c */
268 /* We never throw away stdout, since that is supposed to be the filename
269 found, if all is successful. This variable controls whether stderr
271 boolean make_tex_discard_errors
;
273 /* from variable.c */
274 expansion_type
*expansions
; /* sole variable of this type */
275 unsigned expansion_len
;
277 /* These record the strings we've set and have to keep around.
278 This function can be called many times during a run, and this
279 allows us to reclaim memory we allocated. */
280 char **saved_env
; /* keep track of changed items */
282 #if defined(WIN32) || defined(__CYGWIN__)
284 #endif /* WIN32 || __CYGWIN__ */
286 #if defined(WIN32) && !defined(__MINGW32__)
287 char the_passwd_name
[256];
288 char the_passwd_passwd
[256];
289 char the_passwd_gecos
[256];
290 char the_passwd_dir
[256];
291 char the_passwd_shell
[256];
292 struct passwd the_passwd
;
293 int __system_allow_multiple_cmds
;
294 #endif /* WIN32 && !__MINGW32__ */
297 /* these come from kpathsea.c */
298 extern KPSEDLL kpathsea
kpathsea_new (void) ;
299 extern KPSEDLL
void kpathsea_finish (kpathsea kpse
) ;
301 #if defined (KPSE_COMPAT_API)
303 #define kpse_bug_address kpathsea_bug_address
305 extern KPSEDLL kpathsea_instance kpse_def_inst
;
306 extern KPSEDLL kpathsea kpse_def
;
308 #define kpathsea_debug kpse_def_inst.debug
309 #define kpse_program_name kpse_def_inst.program_name
310 #define kpse_record_input kpse_def_inst.record_input
311 #define kpse_record_output kpse_def_inst.record_output
312 #define kpse_make_tex_discard_errors kpse_def_inst.make_tex_discard_errors
313 #define kpse_fallback_font kpse_def_inst.fallback_font
314 #define kpse_fallback_resolutions_string kpse_def_inst.fallback_resolutions_string
315 #define kpse_fallback_resolutions kpse_def_inst.fallback_resolutions
316 #define kpse_format_info kpse_def_inst.format_info
317 #define kpse_debug_hash_lookup_int kpse_def_inst.debug_hash_lookup_int
319 #undef kpse_invocation_name
320 #define kpse_invocation_name kpse_def_inst.invocation_name
321 #undef kpse_invocation_short_name
322 #define kpse_invocation_short_name kpse_def_inst.invocation_short_name
324 #endif /* KPSE_COMPAT_API */
330 #endif /* not KPATHSEA_TYPES_H */