From 82ba51148809a7b5cfb0716b37e5ec82d616b80d Mon Sep 17 00:00:00 2001 From: mjflick Date: Tue, 25 May 2004 06:11:22 +0000 Subject: added needed files --- include/c-dir.h | 52 +++++++++++++++ include/c-stat.h | 60 +++++++++++++++++ include/c-vararg.h | 41 ++++++++++++ include/line.h | 31 +++++++++ include/str-list.h | 57 ++++++++++++++++ include/systypes.h | 30 +++++++++ include/tex-file.h | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 464 insertions(+) create mode 100644 include/c-dir.h create mode 100644 include/c-stat.h create mode 100644 include/c-vararg.h create mode 100644 include/line.h create mode 100644 include/str-list.h create mode 100644 include/systypes.h create mode 100644 include/tex-file.h diff --git a/include/c-dir.h b/include/c-dir.h new file mode 100644 index 0000000..3825e96 --- /dev/null +++ b/include/c-dir.h @@ -0,0 +1,52 @@ +/* c-dir.h: directory headers. + +Copyright (C) 1992, 93, 94 Free Software Foundation, Inc. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef KPATHSEA_C_DIR_H +#define KPATHSEA_C_DIR_H + +#ifdef WIN32 + +#include + +#else /* not WIN32 */ + +/* Use struct dirent instead of struct direct. */ +#ifdef HAVE_DIRENT_H +#include +#define NAMLEN(dirent) strlen ((dirent)->d_name) +#else /* not DIRENT */ +#define dirent direct +#define NAMLEN(dirent) ((dirent)->d_namlen) + +#ifdef HAVE_SYS_NDIR_H +#include +#endif + +#ifdef HAVE_SYS_DIR_H +#include +#endif + +#ifdef HAVE_NDIR_H +#include +#endif + +#endif /* not DIRENT */ + +#endif /* not WIN32 */ + +#endif /* not KPATHSEA_C_DIR_H */ diff --git a/include/c-stat.h b/include/c-stat.h new file mode 100644 index 0000000..c31d2d0 --- /dev/null +++ b/include/c-stat.h @@ -0,0 +1,60 @@ +/* c-stat.h: declarations for using stat(2). + +Copyright (C) 1993, 96, 2000 Free Software Foundation, Inc. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef KPATHSEA_STAT_H +#define KPATHSEA_STAT_H + +#include "systypes.h" +#include + +#ifdef WIN32 +#include +#endif /* WIN32 */ + +/* POSIX predicates for testing file attributes. */ + +#if !defined (S_ISBLK) && defined (S_IFBLK) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#endif +#if !defined (S_ISCHR) && defined (S_IFCHR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#endif +#if !defined (S_ISDIR) && defined (S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif +#if !defined (S_ISREG) && defined (S_IFREG) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif +#if !defined (S_ISFIFO) && defined (S_IFIFO) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#endif +#if !defined (S_ISLNK) && defined (S_IFLNK) +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#endif +#if !defined (S_ISSOCK) && defined (S_IFSOCK) +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +#endif +#if !defined (S_ISMPB) && defined (S_IFMPB) /* V7 */ +#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +#endif +#if !defined (S_ISNWK) && defined (S_IFNWK) /* HP/UX */ +#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +#endif + +#endif /* not KPATHSEA_STAT_H */ diff --git a/include/c-vararg.h b/include/c-vararg.h new file mode 100644 index 0000000..3f35005 --- /dev/null +++ b/include/c-vararg.h @@ -0,0 +1,41 @@ +/* c-vararg.h: Top layer for stdarg and varargs. + +Copyright (C) 1993 Karl Berry. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef C_VARARG_H +#define C_VARARG_H + +/* See function `init_path' in `kpathsea/tex-file.c' for an example of use. + The idea is to say PVAR1C(type1, parameter1, ap) in the function header, + and then end the function with two }}'s. We do this to avoid having to + specify the argument list (with types) twice -- once in the function + header, and once in a (hypothetical) VA_START1. */ + +#include + +#define PVAR1H(p1) (p1, ...) +#define PVAR2H(p1, p2) (p1, p2, ...) +#define PVAR3H(p1, p2, p3) (p1, p2, p3, ...) + +#define PVAR1C(t1, n1, ap) \ + (t1 n1, ...) { va_list ap; va_start (ap, n1); +#define PVAR2C(t1, n1, t2, n2, ap) \ + (t1 n1, t2 n2, ...) { va_list ap; va_start (ap, n2); +#define PVAR3C(t1, n1, t2, n2, t3, n3, ap) \ + (t1 n1, t2 n2, t3 n3, ...) { va_list ap; va_start (ap, n3); + +#endif /* not C_VARARG_H */ diff --git a/include/line.h b/include/line.h new file mode 100644 index 0000000..d29f940 --- /dev/null +++ b/include/line.h @@ -0,0 +1,31 @@ +/* line.h: read an arbitrary-length input line. + +Copyright (C) 1992 Free Software Foundation, Inc. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef LINE_H +#define LINE_H + +#include +#include "types.h" + + +/* Return NULL if we are at EOF, else the next line of F. The newline + character at the end of string is removed. The string is allocated + with malloc. */ +extern string read_line P1H(FILE *f); + +#endif /* not LINE_H */ diff --git a/include/str-list.h b/include/str-list.h new file mode 100644 index 0000000..78ea16d --- /dev/null +++ b/include/str-list.h @@ -0,0 +1,57 @@ +/* str-list.h: Declarations for string lists. + +Copyright (C) 1993, 94 Karl Berry. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef KPATHSEA_STR_LIST_H +#define KPATHSEA_STR_LIST_H + +#include "c-proto.h" +#include "types.h" + + +/* Lists of strings; used for, e.g., directory lists. */ + +typedef struct +{ + unsigned length; + string *list; +} str_list_type; + +#define STR_LIST_LENGTH(l) ((l).length) +#define STR_LIST(l) ((l).list) +#define STR_LIST_ELT(l, n) STR_LIST (l)[n] +#define STR_LIST_LAST_ELT(l) STR_LIST_ELT (l, STR_LIST_LENGTH (l) - 1) + +/* Return a new, empty, list. */ +extern str_list_type str_list_init P1H(void); + +/* Append the string S to the list L. It's up to the caller to not + deallocate S; we don't copy it. Also up to the caller to terminate + the list with a null entry. */ +extern void str_list_add P2H(str_list_type *l, string s); + +/* Append all the elements from MORE to TARGET. */ +extern void str_list_concat P2H(str_list_type * target, str_list_type more); + +/* Free the space for the list elements (but not the list elements + themselves). */ +extern void str_list_free P1H(str_list_type *l); + +/* Append each element of more to each element of target. */ +extern void str_list_concat_elements P2H(str_list_type * target, str_list_type more); + +#endif /* not KPATHSEA_STR_LIST_H */ diff --git a/include/systypes.h b/include/systypes.h new file mode 100644 index 0000000..b35950b --- /dev/null +++ b/include/systypes.h @@ -0,0 +1,30 @@ +/* c-systypes.h: include . It's too bad we need this file, + but some systems don't protect from multiple + inclusions, and I'm not willing to put up with that. + +Copyright (C) 1993 Karl Berry. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef C_SYSTYPES_H +#define C_SYSTYPES_H + +#include + +/* This is the symbol that X uses to determine if has been + read, so we define it. */ +#define __TYPES__ + +#endif /* not C_SYSTYPES_H */ diff --git a/include/tex-file.h b/include/tex-file.h new file mode 100644 index 0000000..b3f987b --- /dev/null +++ b/include/tex-file.h @@ -0,0 +1,193 @@ +/* tex-file.h: find files in a particular format. + +Copyright (C) 1993, 94, 95, 96 Karl Berry. +Copyright 1998, 1999 Olaf Weber. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef KPATHSEA_TEX_FILE_H +#define KPATHSEA_TEX_FILE_H + +#include "c-proto.h" +#include "c-vararg.h" +#include "types.h" + + +/* If non-NULL, try looking for this if can't find the real font. */ +extern const_string kpse_fallback_font; + + +/* If non-NULL, default list of fallback resolutions comes from this + instead of the compile-time value. Set by dvipsk for the R config + cmd. *SIZES environment variables override/use as default. */ +extern const_string kpse_fallback_resolutions_string; + +/* If non-NULL, check these if can't find (within a few percent of) the + given resolution. List must end with a zero element. */ +extern unsigned *kpse_fallback_resolutions; + +/* This initializes the fallback resolution list. If ENVVAR + is set, it is used; otherwise, the envvar `TEXSIZES' is looked at; if + that's not set either, a compile-time default is used. */ +extern void kpse_init_fallback_resolutions P1H(string envvar); + +/* We put the glyphs first so we don't waste space in an array in + tex-glyph.c. Accompany a new format here with appropriate changes in + tex-file.c and kpsewhich.c (the suffix variable). */ +typedef enum +{ + kpse_gf_format, + kpse_pk_format, + kpse_any_glyph_format, /* ``any'' meaning gf or pk */ + kpse_tfm_format, + kpse_afm_format, + kpse_base_format, + kpse_bib_format, + kpse_bst_format, + kpse_cnf_format, + kpse_db_format, + kpse_fmt_format, + kpse_fontmap_format, + kpse_mem_format, + kpse_mf_format, + kpse_mfpool_format, + kpse_mft_format, + kpse_mp_format, + kpse_mppool_format, + kpse_mpsupport_format, + kpse_ocp_format, + kpse_ofm_format, + kpse_opl_format, + kpse_otp_format, + kpse_ovf_format, + kpse_ovp_format, + kpse_pict_format, + kpse_tex_format, + kpse_texdoc_format, + kpse_texpool_format, + kpse_texsource_format, + kpse_tex_ps_header_format, + kpse_troff_font_format, + kpse_type1_format, + kpse_vf_format, + kpse_dvips_config_format, + kpse_ist_format, + kpse_truetype_format, + kpse_type42_format, + kpse_web2c_format, + kpse_program_text_format, + kpse_program_binary_format, + kpse_miscfonts_format, + kpse_web_format, + kpse_cweb_format, + kpse_last_format /* one past last index */ +} kpse_file_format_type; + + +/* Perhaps we could use this for path values themselves; for now, we use + it only for the program_enabled_p value. */ +typedef enum +{ + kpse_src_implicit, /* C initialization to zero */ + kpse_src_compile, /* configure/compile-time default */ + kpse_src_texmf_cnf, /* texmf.cnf, the kpathsea config file */ + kpse_src_client_cnf, /* application config file, e.g., config.ps */ + kpse_src_env, /* environment variable */ + kpse_src_x, /* X Window System resource */ + kpse_src_cmdline /* command-line option */ +} kpse_src_type; + + +/* For each file format, we record the following information. The main + thing that is not part of this structure is the environment variable + lists. They are used directly in tex-file.c. We could incorporate + them here, but it would complicate the code a bit. We could also do + it via variable expansion, but not now, maybe not ever: + ${PKFONTS-${TEXFONTS-/usr/local/lib/texmf/fonts//}}. */ + +typedef struct +{ + const_string type; /* Human-readable description. */ + const_string path; /* The search path to use. */ + const_string raw_path; /* Pre-$~ (but post-default) expansion. */ + const_string path_source; /* Where the path started from. */ + const_string override_path; /* From client environment variable. */ + const_string client_path; /* E.g., from dvips's config.ps. */ + const_string cnf_path; /* From texmf.cnf. */ + const_string default_path; /* If all else fails. */ + const_string *suffix; /* For kpse_find_file to check for/append. */ + const_string *alt_suffix; /* More suffixes to check for. */ + boolean suffix_search_only; /* Only search with a suffix? */ + const_string program; /* ``mktexpk'', etc. */ + int argc; /* Count of standard arguments. */ + const_string *argv; /* Standard arguments to `program'. */ + boolean program_enabled_p; /* Invoke `program'? */ + kpse_src_type program_enable_level; /* Who said to invoke `program'. */ + boolean binmode; /* The files must be opened in binary mode. */ +} kpse_format_info_type; + +/* The sole variable of that type, indexed by `kpse_file_format_type'. + Initialized by calls to `kpse_find_file' for `kpse_init_format'. */ +extern kpse_format_info_type kpse_format_info[kpse_last_format]; + + +/* If LEVEL is higher than `program_enabled_level' for FMT, set + `program_enabled_p' to VALUE. */ +extern void kpse_set_program_enabled P3H(kpse_file_format_type fmt, + boolean value, kpse_src_type level); +/* Call kpse_set_program_enabled with VALUE and the format corresponding + to FMTNAME. */ +extern void kpse_maketex_option P2H(const_string fmtname, boolean value); + +/* Change the list of searched suffixes (alternate suffixes if alternate is + true). */ +extern void kpse_set_suffixes PVAR2H(kpse_file_format_type format, + boolean alternate); + +/* Initialize the info for the given format. This is called + automatically by `kpse_find_file', but the glyph searching (for + example) can't use that function, so make it available. */ +extern const_string kpse_init_format P1H(kpse_file_format_type); + +/* If FORMAT has a non-null `suffix' member, append it to NAME "." + and call `kpse_path_search' with the result and the other arguments. + If that fails, try just NAME. */ +extern string kpse_find_file P3H(const_string name, + kpse_file_format_type format, boolean must_exist); + +/* Here are some abbreviations. */ +#define kpse_find_mf(name) kpse_find_file (name, kpse_mf_format, true) +#define kpse_find_mft(name) kpse_find_file (name, kpse_mft_format, true) +#define kpse_find_pict(name) kpse_find_file (name, kpse_pict_format, true) +#define kpse_find_tex(name) kpse_find_file (name, kpse_tex_format, true) +#define kpse_find_tfm(name) kpse_find_file (name, kpse_tfm_format, true) +#define kpse_find_ofm(name) kpse_find_file (name, kpse_ofm_format, true) + +/* The `false' is correct for DVI translators, which should clearly not + require vf files for every font (e.g., cmr10.vf). But it's wrong for + VF translators, such as vftovp. */ +#define kpse_find_vf(name) kpse_find_file (name, kpse_vf_format, false) +#define kpse_find_ovf(name) kpse_find_file (name, kpse_ovf_format, false) + +/* Don't just look up the name, actually open the file. */ +extern FILE *kpse_open_file P2H(const_string, kpse_file_format_type); + +/* This function is used to set kpse_program_name (from progname.c) to + a different value. It will clear the path searching information, to + ensure that the search paths are appropriate to the new name. */ + +extern void kpse_reset_program_name P1H(const_string progname); + +#endif /* not KPATHSEA_TEX_FILE_H */ -- cgit v1.2.1