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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#ifdef KPATHSEA
#include "defs.h"
#include <kpathsea/pathsearch.h>
#include <kpathsea/tex-file.h>
#include <kpathsea/tex-glyph.h>
char *
kpsearch_glyph(proto, n, format, acca, name)
char *proto, *n;
kpse_file_format_type format;
struct accarg *acca;
char *name;
{
char *path, *base;
const_string save_path, save_orpath;
kpse_format_info_type *spec = &kpse_format_info[format];
kpse_glyph_file_type font_file;
char *filename;
pavek(name, &path, &base, proto, acca);
if (path != NULL) {
save_path = spec->path;
save_orpath = spec->override_path;
spec->path = NULL;
spec->override_path = path;
}
if (spec->path == NULL)
kpse_init_format(format);
if (acca->acc_mode&ACC_GEN)
spec->program_enabled_p = true;
if (base == NULL)
filename = kpse_find_glyph(n, acca->pv_mag, format, &font_file);
else if (path == NULL)
filename = kpse_find_glyph(base, acca->pv_mag, format, &font_file);
else if (path == NULL)
filename = kpse_find_file(base, format, true);
else
filename = kpse_path_search(spec->path, base, false);
if (path != NULL) {
spec->path = save_path;
spec->override_path = save_orpath;
}
if (acca->acc_mode&ACC_GEN)
spec->program_enabled_p = false;
return filename;
}
char *
kpsearch_make(proto, n, format, suffix, acca, name)
char *proto, *n;
kpse_file_format_type format;
char *suffix;
struct accarg *acca;
char *name;
{
char *path, *base;
char ns[PATHLEN];
const_string save_path, save_orpath, *save_suffix;
kpse_format_info_type *spec = &kpse_format_info[format];
char *filename;
pavek(name, &path, &base, proto, acca);
if (path != NULL) {
save_path = spec->path;
save_orpath = spec->override_path;
spec->path = NULL;
spec->override_path = path;
}
if (spec->path == NULL)
kpse_init_format(format);
if (suffix != NULL) {
save_suffix = spec->alt_suffix;
kpse_set_suffixes(format, true, suffix, NULL);
}
if (acca->acc_mode&ACC_GEN)
spec->program_enabled_p = true;
if (base == NULL) {
filename = NULL;
if (suffix != NULL) {
strncpy(ns, n, sizeof(ns)-1);
ns[sizeof(ns)-1] = '\0';
strncat(ns, suffix, sizeof(ns)-1-strlen(ns));
filename = kpse_find_file(ns, format, true);
}
if (filename == NULL)
filename = kpse_find_file(n, format, true);
} else if (path == NULL)
filename = kpse_find_file(base, format, true);
else
filename = kpse_path_search(spec->path, base, false);
if (path != NULL) {
spec->path = save_path;
spec->override_path = save_orpath;
}
if (suffix != NULL)
spec->alt_suffix = save_suffix;
if (acca->acc_mode&ACC_GEN)
spec->program_enabled_p = false;
return filename;
}
char *
kpsearch_file(proto, n, format)
char *proto, *n;
kpse_file_format_type format;
{
char pathname[PATHLEN]; /* dummy */
char *path, *base;
const_string save_path, save_orpath;
kpse_format_info_type *spec = &kpse_format_info[format];
char *filename;
pavek(pathname, &path, &base, proto, NULL);
if (path != NULL) {
save_path = spec->path;
save_orpath = spec->override_path;
spec->path = NULL;
spec->override_path = path;
}
if (spec->path == NULL)
kpse_init_format(format);
if (base == NULL)
filename = kpse_find_file(n, format, true);
else if (path == NULL)
filename = kpse_find_file(base, format, true);
else
filename = kpse_path_search(spec->path, base, false);
if (path != NULL) {
spec->path = save_path;
spec->override_path = save_orpath;
}
return filename;
}
#endif
|