w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

types.h
Go to the documentation of this file.
1 /* types.h: general types for kpathsea.
2 
3  Copyright 1993, 1995, 1996, 2005, 2008-2014, 2016, 2019 Karl Berry.
4 
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.
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  Lesser General Public License for more details.
14 
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/>. */
17 
18 #ifndef KPATHSEA_TYPES_H
19 #define KPATHSEA_TYPES_H
20 
21 /* Our string, boolean, etc. */
22 #include <kpathsea/simpletypes.h>
23 
24 /* Required forever for any normal build, since we will never want to
25  remove the original interface. But to check that a program
26  only uses the new-style declarations, that is, is thread-safe,
27  could be useful to undefine. */
28 #define KPSE_COMPAT_API 1
29 
30 #include <stdio.h> /* for FILE* */
31 
32 /* Declare int64_t and uint64_t, and define PRId64 etc. */
33 #ifdef HAVE_INTTYPES_H
34 # include <inttypes.h>
35 #endif
36 #ifdef HAVE_STDINT_H
37 # include <stdint.h>
38 #endif
39 #if (!defined __cplusplus || defined __STDC_FORMAT_MACROS) && !defined PRId64
40 # if SIZEOF_LONG == 8
41 # define __PRI64_PREFIX "l"
42 # else
43 # define __PRI64_PREFIX "ll"
44 # endif
45 # define PRId64 __PRI64_PREFIX "d"
46 # define PRIi64 __PRI64_PREFIX "i"
47 # define PRIo64 __PRI64_PREFIX "o"
48 # define PRIu64 __PRI64_PREFIX "u"
49 # define PRIx64 __PRI64_PREFIX "x"
50 # define PRIX64 __PRI64_PREFIX "X"
51 #endif
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /* function pointer prototype definitions for recorder */
60 
61 #ifdef __cplusplus
62 }
63 #endif
64 
65 /* the cache structure from elt-dirs.c */
66 #include <kpathsea/str-llist.h>
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 typedef struct
73 {
76 } cache_entry;
77 
78 /* from variable.c */
79 typedef struct {
81  boolean expanding;
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 
89 #include <kpathsea/hash.h>
90 #include <kpathsea/str-list.h>
91 
92 #ifdef __cplusplus
93 extern "C" {
94 #endif
95 
96 /* from old tex-file.h */
97 
98 /* We put the glyphs first so we don't waste space in an array in
99  tex-glyph.c. Accompany a new format here with appropriate changes in
100  tex-file.c and kpsewhich.c (the suffix variable). */
101 typedef enum
102 {
105  kpse_any_glyph_format, /* ``any'' meaning gf or pk */
162  kpse_last_format /* one past last index */
164 
165 
166 /* Perhaps we could use this for path values themselves; for now, we use
167  it only for the program_enabled_p value. */
168 typedef enum
169 {
170  kpse_src_implicit, /* C initialization to zero */
171  kpse_src_compile, /* configure/compile-time default */
172  kpse_src_texmf_cnf, /* texmf.cnf, the kpathsea config file */
173  kpse_src_client_cnf, /* application config file, e.g., config.ps */
174  kpse_src_env, /* environment variable */
175  kpse_src_x, /* X Window System resource */
176  kpse_src_cmdline /* command-line option */
178 
179 
180 /* For each file format, we record the following information. The main
181  thing that is not part of this structure is the environment variable
182  lists. They are used directly in tex-file.c. We could incorporate
183  them here, but it would complicate the code a bit. We could also do
184  it via variable expansion, but not now, maybe not ever:
185  ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}. */
186 
187 typedef struct
188 {
189  const_string type; /* Human-readable description. */
190  string path; /* The search path to use. */
191  const_string raw_path; /* Pre-$~ (but post-default) expansion. */
192  const_string path_source; /* Where the path started from. */
193  const_string override_path; /* From client environment variable. */
194  const_string client_path; /* E.g., from dvips's config.ps. */
195  const_string cnf_path; /* From texmf.cnf. */
196  const_string default_path; /* If all else fails. */
197  const_string *suffix; /* For kpse_find_file to check for/append. */
198  const_string *alt_suffix; /* More suffixes to check for. */
199  boolean suffix_search_only; /* Only search with a suffix? */
200  const_string program; /* ``mktexpk'', etc. */
201  int argc; /* Count of standard arguments. */
202  const_string *argv; /* Standard arguments to `program'. */
203  boolean program_enabled_p; /* Invoke `program'? */
204  kpse_src_type program_enable_level; /* Who said to invoke `program'. */
205  boolean binmode; /* Open files in binary mode? */
207 
208 #if defined(WIN32) && !defined(__MINGW32__)
209 struct passwd {
210  char *pw_name;
211  char *pw_passwd;
212  int pw_uid;
213  int pw_gid;
214  int pw_quota;
215  char *pw_gecos;
216  char *pw_dir;
217  char *pw_shell;
218 };
219 #endif /* WIN32 && !__MINGW32 */
220 
221 typedef struct kpathsea_instance *kpathsea;
222 
223 typedef struct kpathsea_instance {
224  /* from cnf.c */
225  p_record_input record_input; /* for --recorder */
226  p_record_output record_output; /* for --recorder */
227  hash_table_type cnf_hash; /* used by read_all_cnf */
228  boolean doing_cnf_init; /* for kpse_cnf_get */
229  /* from db.c */
230  hash_table_type db; /* The hash table for all ls-R's */
231  hash_table_type alias_db; /* The hash table for the aliases */
232  str_list_type db_dir_list; /* list of ls-R's */
233  /* from debug.c */
234  unsigned debug; /* for --kpathsea-debug */
235  /* from dir.c */
236  hash_table_type link_table; /* a hash of links-per-dir */
237  /* from elt-dir.c */
239  unsigned cache_length;
240  /* from fontmap.c */
241  hash_table_type map; /* the font mapping hash */
242  const_string map_path; /* path for kpse_fontmap_format */
243  /* from hash.c */
244  /* Print the hash values as integers if this is nonzero. */
246  /* from path-elt.c */
247  string elt; /* static buffer for return value */
248  unsigned elt_alloc;
249  const_string path; /* path we're currently working on */
250  /* from pathsearch.c */
253  boolean log_opened; /* Need to open the log file? */
254  /* from progname.c */
257  string program_name; /* pretended name */
258  int ll_verbose; /* for symlinks (conditional) */
259  /* from tex-file.c */
260  /* If non-NULL, try looking for this if can't find the real font. */
262  /* If non-NULL, default list of fallback resolutions comes from this
263  instead of the compile-time value. Set by dvipsk for the R config
264  cmd. *SIZES environment variables override/use as default. */
266  /* If non-NULL, check these if can't find (within a few percent of) the
267  given resolution. List must end with a zero element. */
270  /* from tex-make.c */
271  /* We never throw away stdout, since that is supposed to be the filename
272  found, if all is successful. This variable controls whether stderr
273  is thrown away. */
276  /* from variable.c */
277  expansion_type *expansions; /* sole variable of this type */
278  unsigned expansion_len ;
279  /* from xputenv.c */
280  /* These record the strings we've set and have to keep around.
281  This function can be called many times during a run, and this
282  allows us to reclaim memory we allocated. */
283  char **saved_env; /* keep track of changed items */
285 #if defined(WIN32) || defined(__CYGWIN__)
286  char **suffixlist;
287 #endif /* WIN32 || __CYGWIN__ */
288 
289 #if defined(WIN32) && !defined(__MINGW32__)
290  char the_passwd_name[256];
291  char the_passwd_passwd[256];
292  char the_passwd_gecos[256];
293  char the_passwd_dir[256];
294  char the_passwd_shell[256];
295  struct passwd the_passwd;
296  int __system_allow_multiple_cmds;
297 #endif /* WIN32 && !__MINGW32__ */
298 #if defined(WIN32)
299  int Is_cp932_system;
300  int File_system_codepage, Win32_codepage;
301  int getc_len;
302  int getc_buff[4];
303  wchar_t wcbuf;
304  int st_len;
305  char st_buff[5];
306  char *st_str;
307 #endif
309 
310 /* these come from kpathsea.c */
311 extern KPSEDLL kpathsea kpathsea_new (void) ;
312 extern KPSEDLL void kpathsea_finish (kpathsea kpse) ;
313 
314 #if defined (KPSE_COMPAT_API)
315 
316 #define kpse_bug_address kpathsea_bug_address
317 
319 extern KPSEDLL kpathsea kpse_def;
320 
321 #define kpathsea_debug kpse_def_inst.debug
322 #define kpse_program_name kpse_def_inst.program_name
323 #define kpse_record_input kpse_def_inst.record_input
324 #define kpse_record_output kpse_def_inst.record_output
325 #define kpse_make_tex_discard_errors kpse_def_inst.make_tex_discard_errors
326 #define kpse_fallback_font kpse_def_inst.fallback_font
327 #define kpse_fallback_resolutions_string kpse_def_inst.fallback_resolutions_string
328 #define kpse_fallback_resolutions kpse_def_inst.fallback_resolutions
329 #define kpse_format_info kpse_def_inst.format_info
330 #define kpse_debug_hash_lookup_int kpse_def_inst.debug_hash_lookup_int
331 
332 #undef kpse_invocation_name
333 #define kpse_invocation_name kpse_def_inst.invocation_name
334 #undef kpse_invocation_short_name
335 #define kpse_invocation_short_name kpse_def_inst.invocation_short_name
336 
337 #endif /* KPSE_COMPAT_API */
338 
339 #ifdef __cplusplus
340 }
341 #endif
342 
343 #endif /* not KPATHSEA_TYPES_H */
static void
Definition: fpif.c:118
static kpathsea kpse
Definition: support.c:104
#define KPSEDLL
Definition: c-proto.h:33
const char * const_string
Definition: simpletypes.h:59
KPSEDLL void kpathsea_finish(kpathsea kpse)
Definition: kpathsea.c:66
struct kpathsea_instance kpathsea_instance
KPSEDLL kpathsea kpse_def
void(* p_record_input)(const_string)
Definition: types.h:58
kpse_src_type
Definition: types.h:169
@ kpse_src_x
Definition: types.h:175
@ kpse_src_cmdline
Definition: types.h:176
@ kpse_src_compile
Definition: types.h:171
@ kpse_src_client_cnf
Definition: types.h:173
@ kpse_src_texmf_cnf
Definition: types.h:172
@ kpse_src_implicit
Definition: types.h:170
@ kpse_src_env
Definition: types.h:174
KPSEDLL kpathsea kpathsea_new(void)
Definition: kpathsea.c:28
void(* p_record_output)(const_string)
Definition: types.h:59
struct kpathsea_instance * kpathsea
Definition: types.h:221
kpse_file_format_type
Definition: types.h:102
@ kpse_web2c_format
Definition: types.h:141
@ kpse_db_format
Definition: types.h:112
@ kpse_vf_format
Definition: types.h:136
@ kpse_bltxml_format
Definition: types.h:161
@ kpse_mft_format
Definition: types.h:118
@ kpse_truetype_format
Definition: types.h:139
@ kpse_fmt_format
Definition: types.h:113
@ kpse_sfd_format
Definition: types.h:149
@ kpse_cnf_format
Definition: types.h:111
@ kpse_tex_ps_header_format
Definition: types.h:133
@ kpse_texpool_format
Definition: types.h:131
@ kpse_troff_font_format
Definition: types.h:134
@ kpse_mem_format
Definition: types.h:115
@ kpse_texsource_format
Definition: types.h:132
@ kpse_miscfonts_format
Definition: types.h:144
@ kpse_opl_format
Definition: types.h:124
@ kpse_dvips_config_format
Definition: types.h:137
@ kpse_program_text_format
Definition: types.h:142
@ kpse_ris_format
Definition: types.h:160
@ kpse_ocp_format
Definition: types.h:122
@ kpse_lig_format
Definition: types.h:152
@ kpse_type1_format
Definition: types.h:135
@ kpse_mlbib_format
Definition: types.h:157
@ kpse_texdoc_format
Definition: types.h:130
@ kpse_tex_format
Definition: types.h:129
@ kpse_cweb_format
Definition: types.h:146
@ kpse_fontmap_format
Definition: types.h:114
@ kpse_pk_format
Definition: types.h:104
@ kpse_program_binary_format
Definition: types.h:143
@ kpse_tfm_format
Definition: types.h:106
@ kpse_texmfscripts_format
Definition: types.h:153
@ kpse_bib_format
Definition: types.h:109
@ kpse_mlbst_format
Definition: types.h:158
@ kpse_otp_format
Definition: types.h:125
@ kpse_mpsupport_format
Definition: types.h:121
@ kpse_gf_format
Definition: types.h:103
@ kpse_ist_format
Definition: types.h:138
@ kpse_enc_format
Definition: types.h:147
@ kpse_pdftex_config_format
Definition: types.h:151
@ kpse_any_glyph_format
Definition: types.h:105
@ kpse_last_format
Definition: types.h:162
@ kpse_cmap_format
Definition: types.h:148
@ kpse_mf_format
Definition: types.h:116
@ kpse_fea_format
Definition: types.h:155
@ kpse_opentype_format
Definition: types.h:150
@ kpse_ovf_format
Definition: types.h:126
@ kpse_lua_format
Definition: types.h:154
@ kpse_afm_format
Definition: types.h:107
@ kpse_base_format
Definition: types.h:108
@ kpse_mppool_format
Definition: types.h:120
@ kpse_pict_format
Definition: types.h:128
@ kpse_web_format
Definition: types.h:145
@ kpse_bst_format
Definition: types.h:110
@ kpse_type42_format
Definition: types.h:140
@ kpse_ofm_format
Definition: types.h:123
@ kpse_mp_format
Definition: types.h:119
@ kpse_cid_format
Definition: types.h:156
@ kpse_clua_format
Definition: types.h:159
@ kpse_ovp_format
Definition: types.h:127
@ kpse_mfpool_format
Definition: types.h:117
KPSEDLL kpathsea_instance kpse_def_inst
Definition: types.h:73
const_string key
Definition: types.h:74
str_llist_type * value
Definition: types.h:75
const_string var
Definition: types.h:80
boolean expanding
Definition: types.h:81
hash_table_type alias_db
Definition: types.h:231
hash_table_type db
Definition: types.h:230
const_string fallback_resolutions_string
Definition: types.h:265
const_string map_path
Definition: types.h:242
kpse_format_info_type format_info[kpse_last_format]
Definition: types.h:269
unsigned debug
Definition: types.h:234
expansion_type * expansions
Definition: types.h:277
unsigned cache_length
Definition: types.h:239
p_record_output record_output
Definition: types.h:226
string program_name
Definition: types.h:257
hash_table_type link_table
Definition: types.h:236
str_list_type db_dir_list
Definition: types.h:232
string elt
Definition: types.h:247
const_string path
Definition: types.h:249
const_string fallback_font
Definition: types.h:261
cache_entry * the_cache
Definition: types.h:238
boolean doing_cnf_init
Definition: types.h:228
boolean debug_hash_lookup_int
Definition: types.h:245
hash_table_type cnf_hash
Definition: types.h:227
hash_table_type map
Definition: types.h:241
boolean log_opened
Definition: types.h:253
string invocation_short_name
Definition: types.h:256
unsigned elt_alloc
Definition: types.h:248
p_record_input record_input
Definition: types.h:225
char ** saved_env
Definition: types.h:283
string invocation_name
Definition: types.h:255
FILE * missfont
Definition: types.h:275
FILE * log_file
Definition: types.h:252
unsigned * fallback_resolutions
Definition: types.h:268
boolean followup_search
Definition: types.h:251
boolean make_tex_discard_errors
Definition: types.h:274
unsigned expansion_len
Definition: types.h:278
const_string type
Definition: types.h:189
const_string program
Definition: types.h:200
const_string override_path
Definition: types.h:193
kpse_src_type program_enable_level
Definition: types.h:204
const_string path_source
Definition: types.h:192
const_string * suffix
Definition: types.h:197
const_string default_path
Definition: types.h:196
const_string raw_path
Definition: types.h:191
boolean program_enabled_p
Definition: types.h:203
boolean suffix_search_only
Definition: types.h:199
const_string cnf_path
Definition: types.h:195
const_string * argv
Definition: types.h:202
const_string client_path
Definition: types.h:194
const_string * alt_suffix
Definition: types.h:198
#define FILE
Definition: t1stdio.h:34