Back to index

tetex-bin  3.0
tex-file.h
Go to the documentation of this file.
00001 /* tex-file.h: find files in a particular format.
00002 
00003 Copyright (C) 1993, 94, 95, 96 Karl Berry.
00004 Copyright 1998, 1999 Olaf Weber.
00005 
00006 This library is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Library General Public
00008 License as published by the Free Software Foundation; either
00009 version 2 of the License, or (at your option) any later version.
00010 
00011 This library is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 Library General Public License for more details.
00015 
00016 You should have received a copy of the GNU Library General Public
00017 License along with this library; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00019 
00020 #ifndef KPATHSEA_TEX_FILE_H
00021 #define KPATHSEA_TEX_FILE_H
00022 
00023 #include <kpathsea/c-proto.h>
00024 #include <kpathsea/c-vararg.h>
00025 #include <kpathsea/types.h>
00026 
00027 
00028 /* If non-NULL, try looking for this if can't find the real font.  */
00029 extern const_string kpse_fallback_font;
00030 
00031 
00032 /* If non-NULL, default list of fallback resolutions comes from this
00033    instead of the compile-time value.  Set by dvipsk for the R config
00034    cmd.  *SIZES environment variables override/use as default.  */
00035 extern KPSEDLL const_string kpse_fallback_resolutions_string;
00036 
00037 /* If non-NULL, check these if can't find (within a few percent of) the
00038    given resolution.  List must end with a zero element.  */
00039 extern unsigned *kpse_fallback_resolutions;
00040 
00041 /* This initializes the fallback resolution list.  If ENVVAR
00042    is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if
00043    that's not set either, a compile-time default is used.  */
00044 extern void kpse_init_fallback_resolutions P1H(string envvar);
00045 
00046 /* We put the glyphs first so we don't waste space in an array in
00047    tex-glyph.c.  Accompany a new format here with appropriate changes in
00048    tex-file.c and kpsewhich.c (the suffix variable).  */
00049 typedef enum
00050 {
00051   kpse_gf_format,
00052   kpse_pk_format,
00053   kpse_any_glyph_format,    /* ``any'' meaning gf or pk */
00054   kpse_tfm_format, 
00055   kpse_afm_format, 
00056   kpse_base_format, 
00057   kpse_bib_format, 
00058   kpse_bst_format, 
00059   kpse_cnf_format,
00060   kpse_db_format,
00061   kpse_fmt_format,
00062   kpse_fontmap_format,
00063   kpse_mem_format,
00064   kpse_mf_format, 
00065   kpse_mfpool_format, 
00066   kpse_mft_format, 
00067   kpse_mp_format, 
00068   kpse_mppool_format, 
00069   kpse_mpsupport_format,
00070   kpse_ocp_format,
00071   kpse_ofm_format, 
00072   kpse_opl_format,
00073   kpse_otp_format,
00074   kpse_ovf_format,
00075   kpse_ovp_format,
00076   kpse_pict_format,
00077   kpse_tex_format,
00078   kpse_texdoc_format,
00079   kpse_texpool_format,
00080   kpse_texsource_format,
00081   kpse_tex_ps_header_format,
00082   kpse_troff_font_format,
00083   kpse_type1_format, 
00084   kpse_vf_format,
00085   kpse_dvips_config_format,
00086   kpse_ist_format,
00087   kpse_truetype_format,
00088   kpse_type42_format,
00089   kpse_web2c_format,
00090   kpse_program_text_format,
00091   kpse_program_binary_format,
00092   kpse_miscfonts_format,
00093   kpse_web_format,
00094   kpse_cweb_format,
00095   kpse_enc_format,
00096   kpse_cmap_format,
00097   kpse_sfd_format,
00098   kpse_opentype_format,
00099   kpse_pdftex_config_format,
00100   kpse_lig_format,
00101   kpse_texmfscripts_format,
00102   kpse_last_format /* one past last index */
00103 } kpse_file_format_type;
00104 
00105 
00106 /* Perhaps we could use this for path values themselves; for now, we use
00107    it only for the program_enabled_p value.  */
00108 typedef enum
00109 {
00110   kpse_src_implicit,   /* C initialization to zero */
00111   kpse_src_compile,    /* configure/compile-time default */
00112   kpse_src_texmf_cnf,  /* texmf.cnf, the kpathsea config file */
00113   kpse_src_client_cnf, /* application config file, e.g., config.ps */
00114   kpse_src_env,        /* environment variable */
00115   kpse_src_x,          /* X Window System resource */
00116   kpse_src_cmdline     /* command-line option */
00117 } kpse_src_type;
00118 
00119 
00120 /* For each file format, we record the following information.  The main
00121    thing that is not part of this structure is the environment variable
00122    lists. They are used directly in tex-file.c. We could incorporate
00123    them here, but it would complicate the code a bit. We could also do
00124    it via variable expansion, but not now, maybe not ever:
00125    ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}.  */
00126 
00127 typedef struct
00128 {
00129   const_string type;        /* Human-readable description.  */
00130   const_string path;        /* The search path to use.  */
00131   const_string raw_path;    /* Pre-$~ (but post-default) expansion.  */
00132   const_string path_source; /* Where the path started from.  */
00133   const_string override_path;      /* From client environment variable.  */
00134   const_string client_path; /* E.g., from dvips's config.ps.  */
00135   const_string cnf_path;    /* From texmf.cnf.  */
00136   const_string default_path;       /* If all else fails.  */
00137   const_string *suffix;            /* For kpse_find_file to check for/append.  */
00138   const_string *alt_suffix; /* More suffixes to check for.  */
00139   boolean suffix_search_only;      /* Only search with a suffix?  */
00140   const_string program;            /* ``mktexpk'', etc.  */
00141   int          argc;        /* Count of standard arguments. */
00142   const_string *argv;              /* Standard arguments to `program'.  */
00143   boolean program_enabled_p;       /* Invoke `program'?  */
00144   kpse_src_type program_enable_level; /* Who said to invoke `program'.  */
00145   boolean binmode;              /* The files must be opened in binary mode. */
00146 } kpse_format_info_type;
00147 
00148 /* The sole variable of that type, indexed by `kpse_file_format_type'.
00149    Initialized by calls to `kpse_find_file' for `kpse_init_format'.  */
00150 extern KPSEDLL kpse_format_info_type kpse_format_info[kpse_last_format];
00151 
00152 
00153 /* If LEVEL is higher than `program_enabled_level' for FMT, set
00154    `program_enabled_p' to VALUE.  */
00155 extern KPSEDLL void kpse_set_program_enabled P3H(kpse_file_format_type fmt,
00156                                          boolean value, kpse_src_type level);
00157 /* Call kpse_set_program_enabled with VALUE and the format corresponding
00158    to FMTNAME.  */
00159 extern KPSEDLL void kpse_maketex_option P2H(const_string fmtname,  boolean value);
00160 
00161 /* Change the list of searched suffixes (alternate suffixes if alternate is
00162    true).  */
00163 extern KPSEDLL void kpse_set_suffixes PVAR2H(kpse_file_format_type format,
00164                                         boolean alternate);
00165 
00166 /* Initialize the info for the given format.  This is called
00167    automatically by `kpse_find_file', but the glyph searching (for
00168    example) can't use that function, so make it available.  */
00169 extern KPSEDLL const_string kpse_init_format P1H(kpse_file_format_type);
00170 
00171 /* If FORMAT has a non-null `suffix' member, append it to NAME "."
00172    and call `kpse_path_search' with the result and the other arguments.
00173    If that fails, try just NAME.  */
00174 extern KPSEDLL string kpse_find_file P3H(const_string name,  
00175                             kpse_file_format_type format,  boolean must_exist);
00176 
00177 /* Here are some abbreviations.  */
00178 #define kpse_find_mf(name)   kpse_find_file (name, kpse_mf_format, true)
00179 #define kpse_find_mft(name)  kpse_find_file (name, kpse_mft_format, true)
00180 #define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true)
00181 #define kpse_find_tex(name)  kpse_find_file (name, kpse_tex_format, true)
00182 #define kpse_find_tfm(name)  kpse_find_file (name, kpse_tfm_format, true)
00183 #define kpse_find_ofm(name)  kpse_find_file (name, kpse_ofm_format, true)
00184 
00185 /* The `false' is correct for DVI translators, which should clearly not
00186    require vf files for every font (e.g., cmr10.vf).  But it's wrong for
00187    VF translators, such as vftovp.  */
00188 #define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false)
00189 #define kpse_find_ovf(name) kpse_find_file (name, kpse_ovf_format, false)
00190 
00191 /* Don't just look up the name, actually open the file.  */
00192 extern KPSEDLL FILE *kpse_open_file P2H(const_string, kpse_file_format_type);
00193 
00194 /* This function is used to set kpse_program_name (from progname.c) to
00195    a different value.  It will clear the path searching information, to
00196    ensure that the search paths are appropriate to the new name. */
00197 
00198 extern KPSEDLL void kpse_reset_program_name P1H(const_string progname);
00199 
00200 #endif /* not KPATHSEA_TEX_FILE_H */