Back to index

tetex-bin  3.0
proginit.c
Go to the documentation of this file.
00001 /* proginit.c: useful initializations for DVI drivers.
00002 
00003 Copyright (C) 1994, 95, 96 Karl Berry.
00004 
00005 This library is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU Library General Public
00007 License as published by the Free Software Foundation; either
00008 version 2 of the License, or (at your option) any later version.
00009 
00010 This library is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 Library General Public License for more details.
00014 
00015 You should have received a copy of the GNU Library General Public
00016 License along with this library; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #include <kpathsea/config.h>
00020 #include <kpathsea/c-pathch.h>
00021 #include <kpathsea/proginit.h>
00022 #include <kpathsea/tex-file.h>
00023 
00024 
00025 /* These initializations were common to all the drivers modified for
00026    kpathsea, so a single routine seemed in order.  Kind of a bollixed-up
00027    mess, but still better than repeating the code.  */
00028 
00029 void
00030 kpse_init_prog P4C(const_string, prefix,  unsigned, dpi,  const_string, mode,
00031                    const_string, fallback)
00032 {
00033   string font_var = concat (prefix, "FONTS");
00034   string header_var = concat (prefix, "HEADERS");
00035   string makepk_var = concat (prefix, "MAKEPK");
00036   string size_var = concat (prefix, "SIZES");
00037   
00038   /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in
00039      general, mktexpk might apply to either, and the program will ask
00040      for the one it wants.  */
00041      
00042   /* Might have a program-specific name for mktexpk itself.  */
00043   if (getenv (makepk_var)) {
00044   /* If we did, we want to enable the program, I think.  */
00045     kpse_set_program_enabled (kpse_pk_format, 1, kpse_src_env);
00046     kpse_set_program_enabled (kpse_any_glyph_format, 1, kpse_src_env);
00047 
00048     kpse_format_info[kpse_pk_format].program
00049       = kpse_format_info[kpse_any_glyph_format].program
00050       = getenv (makepk_var);
00051   }
00052 
00053   /* A couple font paths have traditionally had application-specific
00054      environment variables to override all else; namely, XDVIFONTS and
00055      DVIPSHEADERS.  So set those if we have them.  */
00056   kpse_format_info[kpse_pk_format].override_path
00057     = kpse_format_info[kpse_gf_format].override_path
00058     = kpse_format_info[kpse_any_glyph_format].override_path
00059     = kpse_format_info[kpse_tfm_format].override_path
00060     = getenv (font_var);
00061 
00062   kpse_format_info[kpse_tex_ps_header_format].override_path
00063     = getenv (header_var);
00064 
00065   kpse_init_fallback_resolutions (size_var);
00066   xputenv_int ("MAKETEX_BASE_DPI", dpi);
00067   kpse_fallback_font = fallback;
00068   
00069   /* Ugliness.  See comments in kpse_make_tex in kpathsea/tex-make.c.  */
00070   xputenv ("MAKETEX_MODE", mode ? mode : DIR_SEP_STRING);
00071   
00072   free (font_var);
00073   free (header_var);
00074   free (makepk_var);
00075   free (size_var);
00076 }