diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-03 00:42:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-03 00:42:10 +0000 |
commit | 67257c18c27c5265b15a55ad61d45da410f2f104 (patch) | |
tree | cda7ad04d5508d318053deda2922c990892023d2 /Build/source | |
parent | 7bc782074dd7cba33ad218494c3693c66a33037d (diff) |
formatting/doc fixes
git-svn-id: svn://tug.org/texlive/trunk@16274 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
26 files changed, 254 insertions, 206 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 6c27db9819a..d4ee2195cce 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,11 @@ +2009-12-03 Karl Berry <karl@tug.org> + + * absolute.c, * absolute.h, * cnf.c, * db.c, * dir.c, * elt-dirs.c, + * expand.c, * kdefault.c, * kpsewhich.c, * lib.h, * magstep.h, + * pathsearch.c, * pathsearch.h, * proginit.c, * progname.c, + * readable.h, * tex-file.c, * tex-file.h, * tex-glyph.c, * tex-glyph.h, + * tex-make.c, * types.h, * xputenv.c: formatting/doc fixes. + 2009-12-01 Karl Berry <karl@tug.org> * tex-file.c (kpathsea_name_ok): formatting, doc fixes, start @@ -22,7 +30,7 @@ 2009-11-17 Peter Breitenlohner <peb@mppmu.mpg.de> - * types.h (kpathsea_instance): For Win/Mingw/Cygwin declare + * types.h (kpathsea_instance): For W32/Mingw/Cygwin declare suffixlist, listing the executable file suffixes. * progname.c (kpathsea_set_program_name): Build suffixlist. * tex-file.c (kpathsea_out_name_ok): Use suffixlist. @@ -348,7 +356,7 @@ Added a preprocessor define KPSE_COMPAT_API, used throughout the library. If it is undefined then the old-style functions and definitions are not compiled. - Removed the win32-specific 'cached_home_directory' and 'volumes' + Removed the w32-specific 'cached_home_directory' and 'volumes' variables from the instance structure. Added 'invocation_name' and 'invocation_short_name' variables to the instance structure. diff --git a/Build/source/texk/kpathsea/absolute.c b/Build/source/texk/kpathsea/absolute.c index 1a743c84cd0..01f9f0eca08 100644 --- a/Build/source/texk/kpathsea/absolute.c +++ b/Build/source/texk/kpathsea/absolute.c @@ -1,6 +1,6 @@ /* absolute.c: test if a filename is absolute or explicitly relative. - Copyright 1993, 1994, 1995, 2008 Karl Berry. + Copyright 1993, 1994, 1995, 2008, 2009 Karl Berry. Copyright 1997, 2002, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ to usefully generalize. */ boolean -kpathsea_absolute_p (kpathsea kpse, const_string filename, boolean relative_ok) +kpathsea_absolute_p (kpathsea kpse, const_string filename, boolean relative_ok) { /* (void)kpse; */ /* currenty not used */ #ifdef VMS @@ -74,7 +74,8 @@ int main() char *t[] = { "./foo", "\\\\server\\foo\\bar", "ftp://localhost/foo" }; for (name = t; name - t < sizeof(t)/sizeof(char*); name++) { - printf("Path `%s' %s absolute.\n", *name, (kpse_absolute_p(*name, true) ? "is" : "is not")); + printf ("Path `%s' %s absolute.\n", *name, + kpse_absolute_p(*name, true) ? "is" : "is not"); } } #endif /* TEST */ diff --git a/Build/source/texk/kpathsea/absolute.h b/Build/source/texk/kpathsea/absolute.h index 85c07a15fca..cce71dc6e20 100644 --- a/Build/source/texk/kpathsea/absolute.h +++ b/Build/source/texk/kpathsea/absolute.h @@ -1,6 +1,6 @@ /* absolute.h: declare absolute filename predicate. - Copyright 1993, 1994, 2008 Karl Berry. + Copyright 1993, 1994, 2008, 2009 Karl Berry. Copyright 1999, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -26,10 +26,12 @@ /* True if FILENAME is absolute (/foo) or, if RELATIVE_OK is true, explicitly relative (./foo, ../foo), else false (foo). */ -extern KPSEDLL boolean kpathsea_absolute_p (kpathsea kpse, const_string filename, boolean relative_ok); +extern KPSEDLL boolean kpathsea_absolute_p (kpathsea kpse, + const_string filename, boolean relative_ok); #if defined(KPSE_COMPAT_API) -extern KPSEDLL boolean kpse_absolute_p (const_string filename, boolean relative_ok); +extern KPSEDLL boolean kpse_absolute_p (const_string filename, + boolean relative_ok); #endif #endif /* not KPATHSEA_ABSOLUTE_H */ diff --git a/Build/source/texk/kpathsea/cnf.c b/Build/source/texk/kpathsea/cnf.c index 3ec7e8678e7..91ce92cb785 100644 --- a/Build/source/texk/kpathsea/cnf.c +++ b/Build/source/texk/kpathsea/cnf.c @@ -1,6 +1,6 @@ /* cnf.c: read config files. - Copyright 1994, 1995, 1996, 1997, 2008 Karl Berry. + Copyright 1994, 1995, 1996, 1997, 2008, 2009 Karl Berry. Copyright 1997-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -200,7 +200,8 @@ read_all_cnf (kpathsea kpse) } else { string warn = getenv ("KPATHSEA_WARNING"); if (!(warn && STREQ (warn, "0"))) { - WARNING1 ("kpathsea: configuration file texmf.cnf not found in these directories: %s", + WARNING1 + ("kpathsea: configuration file texmf.cnf not found in these directories: %s", cnf_path); } } diff --git a/Build/source/texk/kpathsea/concatn.c b/Build/source/texk/kpathsea/concatn.c index eebce152711..e108aee9201 100644 --- a/Build/source/texk/kpathsea/concatn.c +++ b/Build/source/texk/kpathsea/concatn.c @@ -1,7 +1,7 @@ /* concatn.c: concatenate an arbitrary number of strings. + Copyright 1993, 1995, 2008, 2009 Karl Berry. Copyright 1999, 2005 Olaf Weber. - Copyright 1993, 1995, 2008 Karl Berry. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/Build/source/texk/kpathsea/db.c b/Build/source/texk/kpathsea/db.c index 650eab72b8a..d0ff236b583 100644 --- a/Build/source/texk/kpathsea/db.c +++ b/Build/source/texk/kpathsea/db.c @@ -1,6 +1,6 @@ /* db.c: an external database to avoid filesystem lookups. - Copyright 1994, 1995, 1996, 1997, 2008 Karl Berry. + Copyright 1994, 1995, 1996, 1997, 2008, 2009 Karl Berry. Copyright 1997-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -99,7 +99,8 @@ db_build (kpathsea kpse, hash_table_type *table, const_string db_filename) and explicitly relative (./...) names here. It's a kludge to pass in the directory name with the trailing : still attached, but it doesn't actually hurt. */ - if (len > 0 && line[len - 1] == ':' && kpathsea_absolute_p (kpse, line, true)) { + if (len > 0 && line[len - 1] == ':' + && kpathsea_absolute_p (kpse, line, true)) { /* New directory line. */ if (!ignore_dir_p (line)) { /* If they gave a relative name, prepend full directory name now. */ @@ -196,7 +197,7 @@ kpathsea_db_insert (kpathsea kpse, const_string passed_fname) void kpse_db_insert (const_string passed_fname) { - kpathsea_db_insert(kpse_def, passed_fname); + kpathsea_db_insert(kpse_def, passed_fname); } #endif @@ -293,7 +294,8 @@ elt_in_db (const_string db_dir, const_string path_elt) /* If ALIAS_FILENAME exists, read it into TABLE. */ static boolean -alias_build (kpathsea kpse, hash_table_type *table, const_string alias_filename) +alias_build (kpathsea kpse, hash_table_type *table, + const_string alias_filename) { string line, real, alias; unsigned count = 0; @@ -344,7 +346,7 @@ alias_build (kpathsea kpse, hash_table_type *table, const_string alias_filename } /* Initialize the path for ls-R files, and read them all into the hash - table `db'. If no usable ls-R's are found, set kpse->db.buckets to NULL. */ + table `db'. If no usable ls-R's found, set kpse->db.buckets to NULL. */ void kpathsea_init_db (kpathsea kpse) @@ -408,7 +410,7 @@ kpathsea_init_db (kpathsea kpse) void kpse_init_db (void) { - kpathsea_init_db(kpse_def); + kpathsea_init_db(kpse_def); } #endif @@ -634,7 +636,7 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, aliases = XTALLOC1 (string); aliases[0] = NULL; } - { /* Push aliases up by one and insert the original name at the front. */ + { /* Push aliases up by one and insert the original name at front. */ unsigned i; unsigned len = 1; /* Have NULL element already allocated. */ for (r = aliases; *r; r++) @@ -659,53 +661,53 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, example, if we have .../cx/cmr10.300pk and .../ricoh/cmr10.300pk, and the path looks like .../cx, we don't want the ricoh file. */ while (!done && db_dirs && *db_dirs) { - string db_file = concat (*db_dirs, ctry); - boolean matched = match (db_file, path); - + string db_file = concat (*db_dirs, ctry); + boolean matched = match (db_file, path); + #ifdef KPSE_DEBUG - if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH)) - DEBUGF3 ("db:match(%s,%s) = %d\n", db_file, path, matched); + if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH)) + DEBUGF3 ("db:match(%s,%s) = %d\n", db_file, path, matched); #endif - /* We got a hit in the database. Now see if the file actually - exists, possibly under an alias. */ - if (matched) { - string found = NULL; - if (kpathsea_readable_file (kpse, db_file)) { - found = db_file; - - } else { - string *a; - - free (db_file); /* `db_file' wasn't on disk. */ - - /* The hit in the DB doesn't exist in disk. Now try all its - aliases. For example, suppose we have a hierarchy on CD, - thus `mf.bas', but ls-R contains `mf.base'. Find it anyway. - Could probably work around this with aliases, but - this is pretty easy and shouldn't hurt. The upshot is that - if one of the aliases actually exists, we use that. */ - for (a = aliases + 1; *a && !found; a++) { - string atry = concat (*db_dirs, *a); - if (kpathsea_readable_file (kpse, atry)) - found = atry; - else - free (atry); - } - } - - /* If we have a real file, add it to the list, maybe done. */ - if (found) { - str_list_add (ret, found); - if (!all && found) - done = true; - } - } else { /* no match in the db */ - free (db_file); + /* We got a hit in the database. Now see if the file actually + exists, possibly under an alias. */ + if (matched) { + string found = NULL; + if (kpathsea_readable_file (kpse, db_file)) { + found = db_file; + + } else { + string *a; + + free (db_file); /* `db_file' wasn't on disk. */ + + /* The hit in the DB doesn't exist in disk. Now try all its + aliases. For example, suppose we have a hierarchy on CD, + thus `mf.bas', but ls-R contains `mf.base'. Find it anyway. + Could probably work around this with aliases, but + this is pretty easy and shouldn't hurt. The upshot is that + if one of the aliases actually exists, we use that. */ + for (a = aliases + 1; *a && !found; a++) { + string atry = concat (*db_dirs, *a); + if (kpathsea_readable_file (kpse, atry)) + found = atry; + else + free (atry); + } + } + + /* If we have a real file, add it to the list, maybe done. */ + if (found) { + str_list_add (ret, found); + if (!all && found) + done = true; } - - /* On to the next directory, if any. */ - db_dirs++; + } else { /* no match in the db */ + free (db_file); + } + + /* On to the next directory, if any. */ + db_dirs++; } /* This is just the space for the pointers, not the strings. */ diff --git a/Build/source/texk/kpathsea/dir.c b/Build/source/texk/kpathsea/dir.c index 54b1551c53c..5f599c15260 100644 --- a/Build/source/texk/kpathsea/dir.c +++ b/Build/source/texk/kpathsea/dir.c @@ -1,6 +1,6 @@ /* dir.c: directory operations. - Copyright 1992, 1993, 1994, 1995, 2008 Karl Berry. + Copyright 1992, 1993, 1994, 1995, 2008, 2009 Karl Berry. Copyright 2000, 2002, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -111,7 +111,8 @@ kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks) memcpy(str_nlinks, (char *)&nlinks, sizeof(nlinks)); str_nlinks[sizeof(nlinks)] = '\0'; /* It's up to us to copy the value. */ - hash_insert(&(kpse->link_table), xstrdup(fn), (const_string)str_nlinks); + hash_insert(&(kpse->link_table), xstrdup (fn), + (const_string) str_nlinks); } #else struct stat stats; diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c index 415de99753b..a8711cb0198 100644 --- a/Build/source/texk/kpathsea/elt-dirs.c +++ b/Build/source/texk/kpathsea/elt-dirs.c @@ -1,6 +1,6 @@ -/* elt-dirs.C: Translate a path element to its corresponding director{y,ies}. +/* elt-dirs.c: Translate a path element to its corresponding director{y,ies}. - Copyright 1993, 1994, 1995, 1996, 1997, 2008 Karl Berry. + Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009 Karl Berry. Copyright 1997, 1998, 1999, 2000, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -176,7 +176,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, name here, we just have a path spec. This means we may descend into a leaf directory cm/pk, if the spec is ...fonts//pk//. */ - expand_elt (kpse, str_list_ptr, FN_STRING (name), potential_len); + expand_elt (kpse, str_list_ptr, FN_STRING (name), potential_len); fn_shrink_to (&name, potential_len); } /* Should we recurse? To see if the subdirectory is a @@ -254,7 +254,8 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, name here, we just have a path spec. This means we may descend into a leaf directory cm/pk, if the spec is ...fonts//pk//. */ - expand_elt (kpse, str_list_ptr, FN_STRING (name), potential_len); + expand_elt (kpse, str_list_ptr, FN_STRING (name), + potential_len); fn_shrink_to (&name, potential_len); } @@ -482,7 +483,7 @@ main () print_element_dirs (".//archive"); /* ./ ./archive/ */ #ifdef AMIGA print_element_dirs ("TeXMF:AmiWeb2c/texmf/fonts//"); /* lots */ - print_element_dirs ("TeXMF:AmiWeb2c/share/texmf/fonts//bakoma"); /* just one */ + print_element_dirs ("TeXMF:AmiWeb2c/share/texmf/fonts//bakoma"); /*just one*/ print_element_dirs ("TeXMF:AmiWeb2c/texmf/fonts//"); /* lots again [cache] */ print_element_dirs ("TeXMF:"); /* TeXMF: */ print_element_dirs ("TeXMF:/"); /* TeXMF: and all subdirs */ diff --git a/Build/source/texk/kpathsea/expand.c b/Build/source/texk/kpathsea/expand.c index 0d9d16c7262..943043a666c 100644 --- a/Build/source/texk/kpathsea/expand.c +++ b/Build/source/texk/kpathsea/expand.c @@ -1,7 +1,7 @@ /* expand.c: general expansion. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2005, 2008 Karl Berry & - Olaf Weber. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2005, 2008, 2009 + Karl Berry & Olaf Weber. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -93,7 +93,8 @@ kpathsea_expand_kpse_dot (kpathsea kpse, string path) boolean ret_copied = true; /* We assume that the !! magic is only used on absolute components. Single "." gets special treatment, as does "./" or its equivalent. */ - if (kpathsea_absolute_p (kpse, elt, false) || (elt[0] == '!' && elt[1] == '!')) { + if (kpathsea_absolute_p (kpse, elt, false) + || (elt[0] == '!' && elt[1] == '!')) { ret = concat3(ret, elt, ENV_SEP_STRING); } else if (elt[0] == '.' && elt[1] == 0) { ret = concat3 (ret, kpse_dot, ENV_SEP_STRING); diff --git a/Build/source/texk/kpathsea/getopt.c b/Build/source/texk/kpathsea/getopt.c index a236e88fde8..058ca27cd70 100644 --- a/Build/source/texk/kpathsea/getopt.c +++ b/Build/source/texk/kpathsea/getopt.c @@ -1,6 +1,6 @@ /* Getopt for GNU. - Copyright 2008 Karl Berry. + Copyright 2008, 2009 Karl Berry. Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 2000 Free Software Foundation, Inc. diff --git a/Build/source/texk/kpathsea/kdefault.c b/Build/source/texk/kpathsea/kdefault.c index 235be28cd9b..43b79965ee5 100644 --- a/Build/source/texk/kpathsea/kdefault.c +++ b/Build/source/texk/kpathsea/kdefault.c @@ -3,7 +3,7 @@ make a program `default' from it, since we have a target `default'; and OSF/1 make doesn't understand .PHONY.) - Copyright 1993, 1994, 1996, 2008 Karl Berry. + Copyright 1993, 1994, 1996, 2008, 2009 Karl Berry. Copyright 2002, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -29,7 +29,8 @@ that is fastest. Usually it will be leading or trailing. */ string -kpathsea_expand_default (kpathsea kpse, const_string path, const_string fallback) +kpathsea_expand_default (kpathsea kpse, const_string path, + const_string fallback) { unsigned path_length; string expansion; @@ -115,7 +116,8 @@ main () test_expand_default (ENV_SEP_STRING, default_path); test_expand_default (ENV_SEP_STRING "first", default_path); test_expand_default ("last" ENV_SEP_STRING, default_path); - test_expand_default ("middle" ENV_SEP_STRING ENV_SEP_STRING "elddim", default_path); + test_expand_default ("middle" ENV_SEP_STRING ENV_SEP_STRING "elddim", + default_path); return 0; } diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c index a4cf22ce528..33b6d327ae7 100644 --- a/Build/source/texk/kpathsea/kpsewhich.c +++ b/Build/source/texk/kpathsea/kpsewhich.c @@ -149,7 +149,7 @@ find_format (kpathsea kpse, string name, boolean is_filename) for (ext = kpse->format_info[f].suffix; !found && ext && *ext; ext++) { found = TRY_SUFFIX (*ext); } - for (ext = kpse->format_info[f].alt_suffix; !found && ext && *ext; ext++){ + for (ext=kpse->format_info[f].alt_suffix; !found && ext && *ext; ext++) { found = TRY_SUFFIX (*ext); } @@ -269,8 +269,8 @@ lookup (kpathsea kpse, string name) unsigned local_dpi = find_dpi (name); if (!local_dpi) local_dpi = dpi; - ret = kpathsea_find_glyph (kpse, remove_suffix (name), local_dpi, fmt, - &glyph_ret); + ret = kpathsea_find_glyph (kpse, remove_suffix (name), + local_dpi, fmt, &glyph_ret); } break; @@ -281,7 +281,8 @@ lookup (kpathsea kpse, string name) default: if (show_all) { - ret_list = kpathsea_find_file_generic (kpse, name, fmt, must_exist, true); + ret_list = kpathsea_find_file_generic (kpse, name, fmt, + must_exist, true); } else { ret = kpathsea_find_file (kpse, name, fmt, must_exist); } diff --git a/Build/source/texk/kpathsea/lib.h b/Build/source/texk/kpathsea/lib.h index f877ca8c782..82fffe578c9 100644 --- a/Build/source/texk/kpathsea/lib.h +++ b/Build/source/texk/kpathsea/lib.h @@ -1,7 +1,7 @@ /* lib.h: declarations for common, low-level routines in kpathsea. + Copyright 1992, 1993, 1994, 1995, 1996, 2008, 2009 Karl Berry. Copyright 1999, 2000, 2003, 2005 Olaf Weber. - Copyright 1992, 1993, 1994, 1995, 1996, 2008 Karl Berry. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -100,13 +100,13 @@ /* Support for FAT/ISO-9660 filesystems. Theoretically this should be done at runtime, per filesystem, but that's painful to program. */ #ifdef MONOCASE_FILENAMES -#define FILESTRCASEEQ(s1, s2) ((s1) && (s2) && (strcasecmp (s1, s2) == 0)) -#define FILESTRNCASEEQ(s1, s2, l) ((s1) && (s2) && (strncasecmp (s1, s2, l) == 0)) -#define FILECHARCASEEQ(c1, c2) (toupper (c1) == toupper (c2)) +#define FILESTRCASEEQ(s1,s2) ((s1) && (s2) && (strcasecmp (s1, s2) == 0)) +#define FILESTRNCASEEQ(s1,s2,l) ((s1) && (s2) && (strncasecmp (s1,s2,l) == 0)) +#define FILECHARCASEEQ(c1,c2) (toupper (c1) == toupper (c2)) #else #define FILESTRCASEEQ STREQ #define FILESTRNCASEEQ STRNEQ -#define FILECHARCASEEQ(c1, c2) ((c1) == (c2)) +#define FILECHARCASEEQ(c1,c2) ((c1) == (c2)) #endif /* This is the maximum number of numerals that result when a 64-bit @@ -173,8 +173,10 @@ extern KPSEDLL string extend_filename (const_string name, const_string suffix); /* Call putenv with the string `VAR=VALUE' and abort on error. */ -extern KPSEDLL void kpathsea_xputenv (kpathsea kpse, const_string var, const_string value); -extern KPSEDLL void kpathsea_xputenv_int (kpathsea kpse, const_string var, int value); +extern KPSEDLL void kpathsea_xputenv (kpathsea kpse, const_string var, + const_string value); +extern KPSEDLL void kpathsea_xputenv_int (kpathsea kpse, const_string var, + int value); #if defined (KPSE_COMPAT_API) extern KPSEDLL void xputenv (const_string var, const_string value); extern KPSEDLL void xputenv_int (const_string var, int value); @@ -194,7 +196,8 @@ extern KPSEDLL boolean dir_p (const_string fn); #if defined (KPSE_COMPAT_API) extern KPSEDLL int dir_links (const_string fn, long nlinks); #endif -extern KPSEDLL int kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks); +extern KPSEDLL int kpathsea_dir_links (kpathsea kpse, const_string fn, + long nlinks); /* Like their stdio counterparts, but abort on error, after calling perror(3) with FILENAME as its argument. */ diff --git a/Build/source/texk/kpathsea/magstep.h b/Build/source/texk/kpathsea/magstep.h index 0359562d4d2..42f02aa96af 100644 --- a/Build/source/texk/kpathsea/magstep.h +++ b/Build/source/texk/kpathsea/magstep.h @@ -1,6 +1,6 @@ /* magstep.h: declaration for magstep fixing. - Copyright 1994, 2008 Karl Berry. + Copyright 1994, 2008, 2009 Karl Berry. Copyright 1999, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -44,7 +44,8 @@ extern KPSEDLL unsigned kpathsea_magstep_fix (kpathsea kpse, unsigned dpi, unsigned bdpi, int *m_ret); #if defined (KPSE_COMPAT_API) -extern KPSEDLL unsigned kpse_magstep_fix (unsigned dpi, unsigned bdpi, int *m_ret); +extern KPSEDLL unsigned kpse_magstep_fix (unsigned dpi, unsigned bdpi, + int *m_ret); #endif #endif /* not KPATHSEA_MAGSTEP_H */ diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c index a2222f3e152..b7f92cb1c53 100644 --- a/Build/source/texk/kpathsea/pathsearch.c +++ b/Build/source/texk/kpathsea/pathsearch.c @@ -1,6 +1,6 @@ /* pathsearch.c: look up a filename in a path. - Copyright 1993, 1994, 1995, 1997, 2007 Karl Berry. + Copyright 1993, 1994, 1995, 1997, 2007, 2009 Karl Berry. Copyright 1997-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -152,8 +152,8 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, } static str_list_type -dir_list_search_list (kpathsea kpse, str_llist_type *dirs, const_string* names, - boolean search_all) +dir_list_search_list (kpathsea kpse, str_llist_type *dirs, const_string* names, + boolean search_all) { str_llist_elt_type *elt; str_list_type ret; @@ -263,7 +263,8 @@ path_search (kpathsea kpse, const_string path, string name, /* Try ls-R, unless we're searching for texmf.cnf. Our caller (search), also tests first_search, and does the resetting. */ - found = kpse->followup_search ? kpathsea_db_search (kpse, name, elt, all) : NULL; + found = kpse->followup_search ? kpathsea_db_search (kpse, name, elt, all) + : NULL; /* Search the filesystem if (1) the path spec allows it, and either (2a) we are searching for texmf.cnf ; or @@ -471,10 +472,11 @@ search_list (kpathsea kpse, const_string path, const_string* names, } /* See elt-dirs.c for side effects of this function. */ - kpathsea_normalize_path(kpse, elt); + kpathsea_normalize_path (kpse, elt); /* Try ls-R, unless we're searching for texmf.cnf. */ - found = kpse->followup_search ? kpathsea_db_search_list(kpse, names, elt, all) : NULL; + found = kpse->followup_search + ? kpathsea_db_search_list (kpse, names, elt, all) : NULL; /* Search the filesystem if (1) the path spec allows it, and either (2a) we are searching for texmf.cnf ; or @@ -554,11 +556,11 @@ kpathsea_path_search (kpathsea kpse, const_string path, const_string name, /* Many inputs, return (more or less indeterminate) one matching string. */ string -kpathsea_path_search_list (kpathsea kpse, const_string path, const_string* names, - boolean must_exist) +kpathsea_path_search_list (kpathsea kpse, const_string path, + const_string* names, boolean must_exist) { - string *ret_list - = kpathsea_path_search_list_generic (kpse, path, names, must_exist, false); + string *ret_list = kpathsea_path_search_list_generic (kpse, path, names, + must_exist, false); string ret = *ret_list; free (ret_list); return ret; @@ -605,7 +607,8 @@ kpse_path_search (const_string path, const_string name, boolean must_exist) } string -kpse_path_search_list (const_string path, const_string* names, boolean must_exist) +kpse_path_search_list (const_string path, const_string* names, + boolean must_exist) { return kpathsea_path_search_list (kpse_def, path, names, must_exist); } @@ -620,7 +623,8 @@ string * kpse_path_search_list_generic (const_string path, const_string* names, boolean must_exist, boolean all) { - return kpathsea_path_search_list_generic (kpse_def, path, names, must_exist, all); + return kpathsea_path_search_list_generic (kpse_def, path, names, + must_exist, all); } string * diff --git a/Build/source/texk/kpathsea/pathsearch.h b/Build/source/texk/kpathsea/pathsearch.h index 81b723d19c8..1238baa696f 100644 --- a/Build/source/texk/kpathsea/pathsearch.h +++ b/Build/source/texk/kpathsea/pathsearch.h @@ -1,6 +1,6 @@ /* pathsearch.h: mostly-generic path searching. - Copyright 1993, 1994, 1996, 1997, 2007, 2008 Karl Berry. + Copyright 1993, 1994, 1996, 1997, 2007, 2008, 2009 Karl Berry. Copyright 1999-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -49,7 +49,8 @@ extern unsigned kpathsea_normalize_path (kpathsea kpse, string elt); It's up to the caller to expand ELT. This is because this routine is most likely only useful to be called from `kpathsea_path_search', which has already assumed expansion has been done. */ -extern KPSEDLL str_llist_type *kpathsea_element_dirs (kpathsea kpse, string elt); +extern KPSEDLL str_llist_type *kpathsea_element_dirs (kpathsea kpse, + string elt); /* Call `kpathsea_expand' on NAME. If the result is an absolute or @@ -85,8 +86,8 @@ extern KPSEDLL string *kpathsea_all_path_search /* Search for any of the NAMES in PATH, and allow specifying both MUST_EXIST and ALL. */ -extern KPSEDLL string *kpathsea_path_search_list_generic - (kpathsea kpse, const_string path, const_string* names, boolean must_exist, boolean all); +extern KPSEDLL string *kpathsea_path_search_list_generic (kpathsea kpse, + const_string path, const_string* names, boolean must_exist, boolean all); /* Search for any of NAMES, with MUST_EXIST and ALL true. */ extern KPSEDLL string *kpathsea_all_path_search_list diff --git a/Build/source/texk/kpathsea/proginit.c b/Build/source/texk/kpathsea/proginit.c index a2127d6500b..7a1b9744711 100644 --- a/Build/source/texk/kpathsea/proginit.c +++ b/Build/source/texk/kpathsea/proginit.c @@ -43,7 +43,7 @@ kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, if (getenv (makepk_var)) { /* If we did, we want to enable the program, I think. */ kpathsea_set_program_enabled (kpse, kpse_pk_format, 1, kpse_src_env); - kpathsea_set_program_enabled (kpse, kpse_any_glyph_format, 1, kpse_src_env); + kpathsea_set_program_enabled (kpse, kpse_any_glyph_format, 1,kpse_src_env); kpse->format_info[kpse_pk_format].program = kpse->format_info[kpse_any_glyph_format].program @@ -80,6 +80,6 @@ void kpse_init_prog (const_string prefix, unsigned dpi, const_string mode, const_string fallback) { - kpathsea_init_prog(kpse_def,prefix,dpi,mode,fallback); + kpathsea_init_prog(kpse_def,prefix,dpi,mode,fallback); } #endif diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index d2ae4848f5f..8918e0dac9c 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -1,6 +1,6 @@ /* progname.c: the executable name we were invoked as; general initialization. - Copyright 1994, 1996, 1997, 2008 Karl Berry. + Copyright 1994, 1996, 1997, 2008, 2009 Karl Berry. Copyright 1998-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -473,7 +473,8 @@ mk_suffixlist (kpathsea kpse) #endif /* WIN32 || __MINGW32__ || __CYGWIN__ */ void -kpathsea_set_program_name (kpathsea kpse, const_string argv0, const_string progname) +kpathsea_set_program_name (kpathsea kpse, const_string argv0, + const_string progname) { string ext, sdir, sdir_parent, sdir_grandparent; string s = getenv ("KPATHSEA_DEBUG"); @@ -634,7 +635,8 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, const_string prog free (sdir_parent); free (sdir_grandparent); - kpse->invocation_short_name = xstrdup((string)xbasename (kpse->invocation_name)); + kpse->invocation_short_name + = xstrdup ((string) xbasename (kpse->invocation_name)); if (progname) { kpse->program_name = xstrdup (progname); @@ -675,13 +677,13 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, const_string prog void kpse_set_program_name (const_string argv0, const_string progname) { - kpathsea_set_program_name (kpse_def, argv0, progname); + kpathsea_set_program_name (kpse_def, argv0, progname); } void kpse_set_progname (const_string argv0) { - kpathsea_set_program_name (kpse_def, argv0, NULL); + kpathsea_set_program_name (kpse_def, argv0, NULL); } #endif diff --git a/Build/source/texk/kpathsea/readable.h b/Build/source/texk/kpathsea/readable.h index ec3a6988d45..23e09c683ee 100644 --- a/Build/source/texk/kpathsea/readable.h +++ b/Build/source/texk/kpathsea/readable.h @@ -1,6 +1,6 @@ /* readable.h: is a file readable? - Copyright 1993, 2008 Karl Berry. + Copyright 1993, 2008, 2009 Karl Berry. Copyright 1999, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -26,7 +26,8 @@ ENAMETOOLONG, truncate any too-long path components, and if the result is a readable file, return that. Otherwise return NULL. */ -extern KPSEDLL string kpathsea_readable_file (kpathsea kpse, const_string name); +extern KPSEDLL string kpathsea_readable_file (kpathsea kpse, + const_string name); #if defined (KPSE_COMPAT_API) extern KPSEDLL string kpse_readable_file (const_string name); diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index a9d1083a505..792f9607638 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -144,7 +144,7 @@ kpathsea_init_fallback_resolutions (kpathsea kpse, string envvar) void kpse_init_fallback_resolutions ( string envvar) { - kpathsea_init_fallback_resolutions (kpse_def, envvar); + kpathsea_init_fallback_resolutions (kpse_def, envvar); } #endif @@ -169,7 +169,7 @@ void kpse_set_program_enabled (kpse_file_format_type fmt, boolean value, kpse_src_type level) { - kpathsea_set_program_enabled(kpse_def, fmt, value, level); + kpathsea_set_program_enabled (kpse_def, fmt, value, level); } #endif @@ -179,13 +179,12 @@ kpse_set_program_enabled (kpse_file_format_type fmt, as well have a common place. */ void -kpathsea_maketex_option (kpathsea kpse, const_string fmtname, boolean value) +kpathsea_maketex_option (kpathsea kpse, const_string fmtname, boolean value) { kpse_file_format_type fmt = kpse_last_format; /* Trying to match up with the suffix lists unfortunately doesn't work well, since that would require initializing the formats. */ - /* FIXME: Currently the function silently ignores unrecognized arguments.*/ if (FILESTRCASEEQ (fmtname, "pk")) { fmt = kpse_pk_format; } else if (FILESTRCASEEQ (fmtname, "mf")) { @@ -200,9 +199,12 @@ kpathsea_maketex_option (kpathsea kpse, const_string fmtname, boolean value) fmt = kpse_ofm_format; } else if (FILESTRCASEEQ (fmtname, "ocp")) { fmt = kpse_ocp_format; + } else { + fprintf (stderr, "\nkpathsea: Unknown mktex format: %s\n", fmtname); } + if (fmt != kpse_last_format) { - kpathsea_set_program_enabled (kpse, fmt, value, kpse_src_cmdline); + kpathsea_set_program_enabled (kpse, fmt, value, kpse_src_cmdline); } } @@ -210,7 +212,7 @@ kpathsea_maketex_option (kpathsea kpse, const_string fmtname, boolean value) void kpse_maketex_option (const_string fmtname, boolean value) { - kpathsea_maketex_option (kpse_def, fmtname, value); + kpathsea_maketex_option (kpse_def, fmtname, value); } #endif @@ -231,7 +233,8 @@ kpse_maketex_option (const_string fmtname, boolean value) `client_path' member must already be set upon entry. */ static void -init_path (kpathsea kpse, kpse_format_info_type *info, const_string default_path, ...) +init_path (kpathsea kpse, kpse_format_info_type *info, + const_string default_path, ...) { string env_name; string env_value = NULL; @@ -359,7 +362,7 @@ kpse_set_suffixes (kpse_file_format_type format, #define FMT_INFO (kpse->format_info[format]) /* Call kpse_set_add_suffixes. */ #define SUFFIXES(args) kpathsea_set_suffixes(kpse, format, false, args, NULL) -#define ALT_SUFFIXES(args) kpathsea_set_suffixes(kpse, format, true, args, NULL) +#define ALT_SUFFIXES(args) kpathsea_set_suffixes(kpse, format, true, args,NULL) /* Call `init_path', including appending the trailing NULL to the envvar list. Also initialize the fields not needed in setting the path. */ @@ -376,12 +379,13 @@ kpse_set_suffixes (kpse_file_format_type format, name to 0 or 1. */ static void -init_maketex (kpathsea kpse, kpse_file_format_type fmt, const_string dflt_prog, ...) +init_maketex (kpathsea kpse, kpse_file_format_type fmt, + const_string dflt_prog, ...) { kpse_format_info_type *f = &(kpse->format_info[fmt]); const_string prog = f->program ? f->program : dflt_prog; /* mktexpk */ - string PROG = uppercasify (prog); /* MKTEXPK */ - string progval = kpathsea_var_value (kpse, PROG); /* ENV/cnf{"MKTEXPK"} */ + string PROG = uppercasify (prog); /* MKTEXPK */ + string progval = kpathsea_var_value (kpse, PROG); /* ENV/cnf{"MKTEXPK"} */ const_string arg; va_list ap; @@ -390,7 +394,7 @@ init_maketex (kpathsea kpse, kpse_file_format_type fmt, const_string dflt_prog, /* Set up the argument vector. */ f->argc = 0; - f->argv = XTALLOC(2, const_string); + f->argv = XTALLOC (2, const_string); f->argv[f->argc++] = dflt_prog; va_start (ap, dflt_prog); while ((arg = va_arg (ap, string)) != NULL) { @@ -404,7 +408,8 @@ init_maketex (kpathsea kpse, kpse_file_format_type fmt, const_string dflt_prog, if (progval && *progval) { /* This might actually be from an environment variable value, but in that case, we'll have previously set it from kpse_init_prog. */ - kpathsea_set_program_enabled (kpse, fmt, *progval == '1', kpse_src_client_cnf); + kpathsea_set_program_enabled (kpse, fmt, *progval == '1', + kpse_src_client_cnf); } free (PROG); @@ -624,7 +629,7 @@ kpathsea_init_format (kpathsea kpse, kpse_file_format_type format) SUFFIXES (".tex"); /* TeX files can have any obscure suffix in the world (or none at all). Only check for the most common ones. */ -#define ALT_TEX_SUFFIXES ".sty", ".cls", ".fd", ".aux", ".bbl", ".def", ".clo", ".ldf" +#define ALT_TEX_SUFFIXES ".sty",".cls",".fd",".aux",".bbl",".def",".clo",".ldf" ALT_SUFFIXES (ALT_TEX_SUFFIXES); break; case kpse_tex_ps_header_format: @@ -751,7 +756,7 @@ kpathsea_init_format (kpathsea kpse, kpse_file_format_type format) FMT_INFO.suffix_search_only = true; break; case kpse_fea_format: - INIT_FORMAT ("font feature files", DEFAULT_FONTFEATURES, FONTFEATURES_ENVS); + INIT_FORMAT("font feature files",DEFAULT_FONTFEATURES,FONTFEATURES_ENVS); SUFFIXES (".fea"); FMT_INFO.suffix_search_only = true; break; @@ -851,7 +856,8 @@ kpse_init_format (kpse_file_format_type format) the support working nonetheless. */ static void -target_fontmaps (kpathsea kpse, string **target, unsigned *count, const_string name) +target_fontmaps (kpathsea kpse, string **target, unsigned *count, + const_string name) { string *mapped_names = kpathsea_fontmap_lookup (kpse, name); @@ -923,10 +929,11 @@ target_suffixed_names (kpathsea kpse, string **target, unsigned *count, thing for clients to call. */ string -kpathsea_find_file (kpathsea kpse, const_string name, kpse_file_format_type format, - boolean must_exist) +kpathsea_find_file (kpathsea kpse, const_string name, + kpse_file_format_type format, boolean must_exist) { - string *ret_list = kpathsea_find_file_generic (kpse, name, format, must_exist, false); + string *ret_list = kpathsea_find_file_generic (kpse, name, format, + must_exist, false); string ret = *ret_list; free (ret_list); return ret; @@ -945,8 +952,8 @@ kpse_find_file (const_string name, kpse_file_format_type format, hence we always return a NULL-terminated list. */ string * -kpathsea_find_file_generic (kpathsea kpse, const_string const_name, kpse_file_format_type format, - boolean must_exist, boolean all) +kpathsea_find_file_generic (kpathsea kpse, const_string const_name, + kpse_file_format_type format, boolean must_exist, boolean all) { string *target, name; const_string *ext; @@ -975,7 +982,8 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, kpse_file_f /* Do variable and tilde expansion. */ name = kpathsea_expand (kpse, const_name); - try_std_extension_first = kpathsea_var_value (kpse, "try_std_extension_first"); + try_std_extension_first + = kpathsea_var_value (kpse, "try_std_extension_first"); has_any_suffix = strrchr (name, '.'); if (has_any_suffix) { string p = strchr (has_any_suffix, DIR_SEP); @@ -1028,7 +1036,9 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, kpse_file_f } /* Search, trying to minimize disk-pounding. */ - ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, (const_string*)target, false, all); + ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, + (const_string*) target, false, all); + /* Do we need to pound the disk? */ if (! *ret && must_exist) { for (count = 0; target[count]; count++) @@ -1045,7 +1055,8 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, kpse_file_f target[count++] = xstrdup (name); } target[count] = NULL; - ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, (const_string*)target, true, all); + ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, + (const_string*) target, true, all); } /* Free the list we created. */ @@ -1231,7 +1242,7 @@ executable_filep (kpathsea kpse, const_string fname) if (pp && q) { while (*pp) { if (strchr (fname, ':') || !strcmp (q, *pp)) { - fprintf (stderr, "\nThe name %s is forbidden to open for writing.\n", + fprintf (stderr, "\n%s: Forbidden to open for writing\n", fname); free (base); return true; @@ -1281,7 +1292,8 @@ kpse_out_name_ok (const_string fname) resulting file, or exit with an error message. */ FILE * -kpathsea_open_file (kpathsea kpse, const_string name, kpse_file_format_type type) +kpathsea_open_file (kpathsea kpse, const_string name, + kpse_file_format_type type) { string fullname = kpathsea_find_file (kpse, name, type, true); const_string mode = kpse->format_info[type].binmode @@ -1293,7 +1305,7 @@ kpathsea_open_file (kpathsea kpse, const_string name, kpse_file_format_type typ perror (fullname); exit (1); } else { - LIB_FATAL2 ("%s file `%s' not found", kpse->format_info[type].type, name); + LIB_FATAL2 ("%s file `%s' not found", kpse->format_info[type].type,name); } } @@ -1362,6 +1374,6 @@ kpathsea_reset_program_name (kpathsea kpse, const_string progname) void kpse_reset_program_name (const_string progname) { - kpathsea_reset_program_name (kpse_def, progname); + kpathsea_reset_program_name (kpse_def, progname); } #endif diff --git a/Build/source/texk/kpathsea/tex-file.h b/Build/source/texk/kpathsea/tex-file.h index 49b0a41e878..48c17d3c3ea 100644 --- a/Build/source/texk/kpathsea/tex-file.h +++ b/Build/source/texk/kpathsea/tex-file.h @@ -1,6 +1,6 @@ /* tex-file.h: find files in a particular format. - Copyright 1993, 1994, 1995, 1996, 2007, 2008 Karl Berry. + Copyright 1993, 1994, 1995, 1996, 2007, 2008, 2009 Karl Berry. Copyright 1998-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -32,40 +32,39 @@ extern void kpathsea_init_fallback_resolutions (kpathsea kpse, string envvar); /* If LEVEL is higher than `program_enabled_level' for FMT, set `program_enabled_p' to VALUE. */ extern KPSEDLL void kpathsea_set_program_enabled (kpathsea kpse, - kpse_file_format_type fmt, - boolean value, kpse_src_type level); + 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 KPSEDLL void kpathsea_maketex_option (kpathsea kpse, const_string fmtname, - boolean value); +extern KPSEDLL void kpathsea_maketex_option (kpathsea kpse, + const_string fmtname, boolean value); /* Change the list of searched suffixes (alternate suffixes if alternate is true). */ extern KPSEDLL void kpathsea_set_suffixes (kpathsea kpse, - kpse_file_format_type format, - boolean alternate, ...); + 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 KPSEDLL const_string kpathsea_init_format (kpathsea kpse, - kpse_file_format_type format); + kpse_file_format_type format); /* 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 KPSEDLL string kpathsea_find_file (kpathsea kpse, const_string name, - kpse_file_format_type format, boolean must_exist); + kpse_file_format_type format, boolean must_exist); /* Ditto, allowing ALL parameter and hence returning a NULL-terminated list of results. */ -extern KPSEDLL string *kpathsea_find_file_generic - (kpathsea kpse, const_string name, kpse_file_format_type format, - boolean must_exist, boolean all); +extern KPSEDLL string *kpathsea_find_file_generic (kpathsea kpse, + const_string name, kpse_file_format_type format, boolean must_exist, + boolean all); /* Return true if FNAME is acceptable to open for reading or writing. */ extern KPSEDLL boolean kpathsea_in_name_ok (kpathsea kpse, const_string fname); -extern KPSEDLL boolean kpathsea_out_name_ok (kpathsea kpse, const_string fname); +extern KPSEDLL boolean kpathsea_out_name_ok (kpathsea kpse,const_string fname); /* Don't just look up the name, actually open the file. */ extern KPSEDLL FILE *kpathsea_open_file (kpathsea kpse, const_string name, diff --git a/Build/source/texk/kpathsea/tex-glyph.c b/Build/source/texk/kpathsea/tex-glyph.c index 728f95ea134..c9f480c73c5 100644 --- a/Build/source/texk/kpathsea/tex-glyph.c +++ b/Build/source/texk/kpathsea/tex-glyph.c @@ -1,6 +1,6 @@ /* tex-glyph.c: search for GF/PK files. - Copyright 1993, 1994, 1995, 1996, 2008 Karl Berry. + Copyright 1993, 1994, 1995, 1996, 2008, 2009 Karl Berry. Copyright 1997, 1998, 1999, 2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -121,23 +121,23 @@ try_resolution (kpathsea kpse, const_string fontname, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file) { - string ret = try_size (kpse, fontname, dpi, format, glyph_file); - - if (!ret) - { - unsigned r; - unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi); - /* Cast to unsigned to shut up stupid compilers. */ - unsigned lower_bound = (int) (dpi - tolerance) < 0 ? 0 : (unsigned)(dpi - tolerance); - unsigned upper_bound = (unsigned)(dpi + tolerance); - - /* Prefer scaling up to scaling down, since scaling down can omit - character features (Tom did this in dvips). */ - for (r = lower_bound; !ret && r <= upper_bound; r++) - if (r != dpi) - ret = try_size (kpse, fontname, r, format, glyph_file); - } + string ret = try_size (kpse, fontname, dpi, format, glyph_file); + if (!ret) { + unsigned r; + unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi); + /* Cast to unsigned to shut up stupid compilers. */ + unsigned lower_bound = (int) (dpi - tolerance) < 0 + ? 0 : (unsigned)(dpi - tolerance); + unsigned upper_bound = (unsigned)(dpi + tolerance); + + /* Prefer scaling up to scaling down, since scaling down can omit + character features (Tom did this in dvips). */ + for (r = lower_bound; !ret && r <= upper_bound; r++) + if (r != dpi) + ret = try_size (kpse, fontname, r, format, glyph_file); + } + return ret; } @@ -291,7 +291,7 @@ kpathsea_find_glyph (kpathsea kpse, /* If mktex... failed, try any fallback resolutions. */ else { if (kpse->fallback_resolutions) - ret = try_fallback_resolutions (kpse, fontname, dpi, format, glyph_file); + ret = try_fallback_resolutions (kpse, fontname, dpi,format,glyph_file); /* We're down to the font of last resort. */ if (!ret && kpse->fallback_font) { @@ -304,7 +304,7 @@ kpathsea_find_glyph (kpathsea kpse, /* The fallback font at the fallback resolutions. */ if (!ret && kpse->fallback_resolutions) - ret = try_fallback_resolutions (kpse, name, dpi, format, glyph_file); + ret = try_fallback_resolutions (kpse, name, dpi, format, glyph_file); } } } @@ -329,7 +329,8 @@ kpse_find_glyph (const_string passed_fontname, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file) { - return kpathsea_find_glyph(kpse_def, passed_fontname, dpi, format, glyph_file); + return kpathsea_find_glyph (kpse_def, passed_fontname, dpi, format, + glyph_file); } #endif @@ -385,7 +386,7 @@ main (int argc, char **argv) { kpathsea kpse = xcalloc(1,sizeof(kpathsea_instance)); kpathsea_set_program_name(kpse, argv[0], NULL); - test_find_glyph (kpse, "/usr/local/lib/tex/fonts/cm/cmr10", 300); /* absolute */ + test_find_glyph (kpse, "/usr/local/lib/tex/fonts/cm/cmr10", 300); /* abs. */ test_find_glyph (kpse, "cmr10", 300); /* normal */ test_find_glyph (kpse, "logo10", 300); /* find gf */ test_find_glyph (kpse, "cmr10", 299); /* find 300 */ @@ -394,7 +395,7 @@ main (int argc, char **argv) kpse->kpse_fallback_font = "cmr10"; test_find_glyph (kpse, "fallback", 300); /* find fallback font cmr10 */ kpathsea_init_fallback_resolutions (kpse, "KPATHSEA_TEST_SIZES"); - test_find_glyph (kpse, "fallbackdpi", 759); /* find fallback font cmr10@300 */ + test_find_glyph (kpse, "fallbackdpi", 759); /* find fallback cmr10@300 */ kpathsea_xputenv (kpse,"GFFONTS", "."); test_find_glyph (kpse, "cmr10", 300); /* different GFFONTS/TEXFONTS */ diff --git a/Build/source/texk/kpathsea/tex-glyph.h b/Build/source/texk/kpathsea/tex-glyph.h index 5ee80276790..74eb23bb21f 100644 --- a/Build/source/texk/kpathsea/tex-glyph.h +++ b/Build/source/texk/kpathsea/tex-glyph.h @@ -49,12 +49,13 @@ typedef struct /* Search first for the font named FONT_NAME at resolution DPI in the glyph format FORMAT (see `try_size' for details of format searching). - Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI. Then try - the resolutions in `kpse_fallback_sizes', then within the tolerance - of each of those. Then if FONT_NAME is an alias defined in a - texfonts.map do all the above for its real name. Then try the above - for kpse_fallback_name. Then fail. Return either the filename - found, or NULL. Also return information about the file found in + Then try resolutions within KPSE_BITMAP_TOLERANCE of DPI. Then if + FONT_NAME is an alias defined in a texfonts.map do all the above for + its real name. If not an alias, try creating it on the fly with + mktexpk. Then try the resolutions in `kpse_fallback_sizes', then + within the tolerance of each of those. Then try the above for + kpse_fallback_name. Then fail. Return either the filename found, or + NULL. Also return information about the file found in *GLYPH_FILE. */ extern KPSEDLL string kpathsea_find_glyph (kpathsea kpse, const_string font_name, unsigned dpi, diff --git a/Build/source/texk/kpathsea/tex-make.c b/Build/source/texk/kpathsea/tex-make.c index 69a6c9f2134..5ccfd8193e2 100644 --- a/Build/source/texk/kpathsea/tex-make.c +++ b/Build/source/texk/kpathsea/tex-make.c @@ -1,6 +1,6 @@ /* tex-make.c: run external programs to make TeX-related files. - Copyright 1993, 1994, 1995, 1996, 1997, 2008 Karl Berry. + Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009 Karl Berry. Copyright 1997, 1998, 2001-05 Olaf Weber. This library is free software; you can redistribute it and/or @@ -114,10 +114,11 @@ misstex (kpathsea kpse, kpse_file_format_type format, string *args) missfont_name = NULL; /* user requested no missfont.log */ } /* else use user's name */ - kpse->missfont = missfont_name ? fopen (missfont_name, FOPEN_A_MODE) : NULL; + kpse->missfont + = missfont_name ? fopen (missfont_name, FOPEN_A_MODE) : NULL; if (!kpse->missfont && kpathsea_var_value (kpse, "TEXMFOUTPUT")) { - missfont_name = concat3 (kpathsea_var_value (kpse, "TEXMFOUTPUT"), DIR_SEP_STRING, - missfont_name); + missfont_name = concat3 (kpathsea_var_value (kpse, "TEXMFOUTPUT"), + DIR_SEP_STRING, missfont_name); kpse->missfont = fopen (missfont_name, FOPEN_A_MODE); } @@ -271,7 +272,8 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) &si, /* pointer to STARTUPINFO */ &pi /* pointer to PROCESS_INFORMATION */ ) == 0) { - LIB_FATAL2("kpathsea: CreateProcess() failed for `%s' (Error %x)\n", new_cmd, GetLastError()); + LIB_FATAL2 ("kpathsea: CreateProcess() failed for `%s' (Error %x)\n", + new_cmd, GetLastError()); } CloseHandle(child_in); @@ -287,7 +289,8 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) && num > 0) { if (num <= 0) { if (GetLastError() != ERROR_BROKEN_PIPE) { - LIB_FATAL2("kpathsea: read() error code for `%s' (Error %d)", new_cmd, GetLastError()); + LIB_FATAL2 ("kpathsea: read() error code for `%s' (Error %d)", + new_cmd, GetLastError()); break; } } else { @@ -302,8 +305,8 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) CloseHandle(father_in); if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_OBJECT_0) { - WARNING2("kpathsea: failed to wait for process termination: %s (Error %d)\n", - new_cmd, GetLastError()); + WARNING2 ("kpathsea: process termination wait failed: %s (Error %d)\n", + new_cmd, GetLastError()); } CloseHandle(pi.hProcess); @@ -472,7 +475,8 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) return NULL. */ string -kpathsea_make_tex (kpathsea kpse, kpse_file_format_type format, const_string base) +kpathsea_make_tex (kpathsea kpse, kpse_file_format_type format, + const_string base) { kpse_format_info_type spec; /* some compilers lack struct initialization */ string ret = NULL; diff --git a/Build/source/texk/kpathsea/types.h b/Build/source/texk/kpathsea/types.h index c70abe13ade..72b82df14ff 100644 --- a/Build/source/texk/kpathsea/types.h +++ b/Build/source/texk/kpathsea/types.h @@ -195,7 +195,7 @@ typedef struct kpathsea_instance { hash_table_type cnf_hash; /* used by read_all_cnf */ boolean doing_cnf_init; /* for kpse_cnf_get */ /* from db.c */ - hash_table_type db; /* The hash table for all the ls-R's. */ + hash_table_type db; /* The hash table for all ls-R's */ hash_table_type alias_db; /* The hash table for the aliases */ str_list_type db_dir_list; /* list of ls-R's */ /* from debug.c */ @@ -207,14 +207,14 @@ typedef struct kpathsea_instance { unsigned cache_length; /* from fontmap.c */ hash_table_type map; /* the font mapping hash */ - const_string map_path; /* holds the format path for kpse_fontmap_format */ + const_string map_path; /* path for kpse_fontmap_format */ /* from hash.c */ /* Print the hash values as integers if this is nonzero. */ boolean debug_hash_lookup_int; /* from path-elt.c */ - string elt; /* statically created buffer for return value of |element| */ + string elt; /* static buffer for return value */ unsigned elt_alloc; - const_string path; /* The path we're currently working on. */ + const_string path; /* path we're currently working on */ /* from pathsearch.c */ boolean followup_search; FILE *log_file; diff --git a/Build/source/texk/kpathsea/xputenv.c b/Build/source/texk/kpathsea/xputenv.c index a3a55bd4ff0..8128a724470 100644 --- a/Build/source/texk/kpathsea/xputenv.c +++ b/Build/source/texk/kpathsea/xputenv.c @@ -1,6 +1,6 @@ /* xputenv.c: set an environment variable without return. */ -/* Copyright 1993-98, 2008 Karl Berry. +/* Copyright 1993-98, 2008, 2009 Karl Berry. Copyright 2003-05 Olaf Weber. This library is free software; you can redistribute it and/or @@ -82,15 +82,14 @@ kpathsea_xputenv(kpathsea kpse, const char *var, const char *value) } /* If we get here, it means getenv() returned a reference to cur_item. - * So we save cur_item, and free the old string we also owned. - */ + So we save cur_item, and free the old string we also owned. */ if (cur_loc == kpse->saved_count) { - /* No old string. */ - kpse->saved_count++; - kpse->saved_env = XRETALLOC(kpse->saved_env, kpse->saved_count, char *); + /* No old string. */ + kpse->saved_count++; + kpse->saved_env = XRETALLOC(kpse->saved_env, kpse->saved_count, char *); } else { - /* We owned the old string. */ - free(kpse->saved_env[cur_loc]); + /* We owned the old string. */ + free(kpse->saved_env[cur_loc]); } kpse->saved_env[cur_loc] = cur_item; @@ -115,12 +114,12 @@ kpathsea_xputenv_int (kpathsea kpse, const_string var_name, int num) void xputenv(const char *var, const char *value) { - kpathsea_xputenv(kpse_def, var, value); + kpathsea_xputenv(kpse_def, var, value); } void xputenv_int (const_string var_name, int num) { - kpathsea_xputenv_int(kpse_def, var_name, num); + kpathsea_xputenv_int(kpse_def, var_name, num); } #endif |