1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/* kpseinterface.{c,h} -- interface with the kpathsea library
*
* Copyright (c) 2003-2011 Eddie Kohler
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version. This program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*/
#include <kpathsea/config.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <kpathsea/progname.h>
#include <kpathsea/expand.h>
#include <kpathsea/c-pathch.h>
#include <kpathsea/tex-file.h>
#include "kpseinterface.h"
int kpsei_env_sep_char = ENV_SEP;
void
kpsei_init(const char* argv0, const char* progname)
{
kpse_set_program_name(argv0, progname);
#ifdef SELFAUTODIR
putenv("SELFAUTODIR=" SELFAUTODIR);
#endif
#ifdef SELFAUTOLOC
putenv("SELFAUTOLOC=" SELFAUTOLOC);
#endif
#ifdef SELFAUTOPARENT
putenv("SELFAUTOPARENT=" SELFAUTOPARENT);
#endif
}
char*
kpsei_path_expand(const char* path)
{
return kpse_path_expand(path);
}
char*
kpsei_find_file(const char* name, int format)
{
switch (format) {
case KPSEI_FMT_WEB2C:
return kpse_find_file(name, kpse_web2c_format, true);
case KPSEI_FMT_ENCODING:
return kpse_find_file(name, kpse_tex_ps_header_format, true);
case KPSEI_FMT_TYPE1:
return kpse_find_file(name, kpse_type1_format, false);
case KPSEI_FMT_TYPE42:
return kpse_find_file(name, kpse_type42_format, false);
case KPSEI_FMT_TRUETYPE:
return kpse_find_file(name, kpse_truetype_format, false);
#if HAVE_DECL_KPSE_OPENTYPE_FORMAT
case KPSEI_FMT_OPENTYPE:
return kpse_find_file(name, kpse_opentype_format, false);
#endif
case KPSEI_FMT_OTHER_TEXT:
return kpse_find_file(name, kpse_program_text_format, true);
case KPSEI_FMT_MAP:
return kpse_find_file(name, kpse_fontmap_format, true);
default:
return 0;
}
}
void
kpsei_set_debug_flags(unsigned flags)
{
kpathsea_debug = flags;
}
|